Compare commits

...

590 Commits

Author SHA1 Message Date
4dcd19d9bc NVIM v0.1.4
Features:
  5ebffaa :tcd for tab-local working directory (like :lcd, but for tabs)
  d835c03 remote/define.vim: support remote function "range"
  007d573 json_encode/json_decode (with sophisticated error detection) #4131
  b50afb4 clipboard: support "lemonade" tool

Fixes:
  cc1beec eval.c: Fix heap corruption error. #4592
  4043725 mbyte.c: Fix invalid memory access in utfc_ptr2char_len #4574
  4eb5827 Enable syntax/filetype by default. #4558

Changes:
  5c6592f v:windowid is writeable (useful for GUIs) #4608
2016-04-24 21:46:34 -04:00
4f5a18237b release.sh: Automate release process. 2016-04-24 21:46:09 -04:00
ab63f5d934 Merge pull request #4636 from blueyed/vim-patch-fix-find_git_remote
vim-patch.sh: fix/improve pattern with find_git_remote
2016-04-24 14:44:50 -04:00
a9f97226ae vim-patch.sh: fix/improve pattern with find_git_remote 2016-04-24 19:07:41 +02:00
1cc869ffb9 Merge pull request #4571 from bfredl/pumtest
more screen tests for completion popupmenu
2016-04-24 16:01:29 +02:00
3c4544c532 tests/ui: screen tests for completion popupmenu 2016-04-24 15:17:39 +02:00
3098b18a2b vim-patch.sh: Query git for name of neovim remote
Rather than assume the user named their neovim/neovim remote "upstream",
parse the information from "git remote -v".
2016-04-23 15:32:43 -04:00
3d7a6e4d54 Merge pull request #4367 from jbradaric/vim-7.4.1107
vim-patch:7.4.{1107,1114,1116,1117,1120}
2016-04-22 04:11:45 -04:00
c4de9c7cc9 version.c: update. #4301
NA patches:

238, 244 SMACK support
1220 Tiny build
1221 configure
1222 Tiny build
1224 Makefile
1225 old style functions
1226 GRESOURCE_HDR
1227 compiler warning
1240, 1241 Makefile
1242 FEAT_EVAL
1243 Compiler warning
1245, 1251 Filelist
1270, 1272, 1280 if_python
1277 ifdef
1290 job
1292 Compiler warning
1320, 1323, 1326, 1332 Makefile
1334, 1339 char_u cast for Windows
1340 Windows build
1344, 1345 Windows
1348 Windows GUI
1349 if_mzscheme
1350 RealWaitForChar()
1154, 1156, 1157, 1160, 1163-1168, 1173, 1178, 1181, 1188, 1269, 1278, 1279 json
1229-1235, 1238, 1239, 1244, 1246-1250, 1252-1258, 1260-1268, 1274-1275, 1283, channel/job
1286-1289, 1291, 1293-1295, 1297-1299, 1301-1304, 1306-1319, 1321, 1322, 1324, channel/job
1325, 1327-1331, 1333, 1335-1338, 1341-1343 channel/job
1351, 1353, 1355-1362, 1369-1374, 1376 channel/job
1354 Makefile
1363 Tiny Build
1364, 1368, 1375 Remove Win16 code
1367 json
1387 Win16
1377-1382, 1385, 1386, 1389, 1393, 1395, 1398, 1404 channel
1383 GVimExt
1390 configure
1391 Compiler warning
1392 Makefile
1399 MS-DOS
1400 if_perl
1402, 1409 GTK-3 support
1403 ifdef Quickfix
1407, 1408 JSON
1411 wrong indent
1412 wrong indent
1413, 1418, 1421-1423 channel
1414, 1415 Appveyor
1416 char_u fix
1417 Filelist
1419 --not-a-terminal
1420, 1424 Makefile

1426, 1435, 1438, 1441, 1447, 1449 channel
1427 C89
1428 DirectWrite
1429 Win32 GUI
1430, 1434, 1439, 1444-1446, 1448, 1450 JSON
1431 if_scope
1432 GUI GTK
1433 if_sniff
1436 Filelist
1437 isnan(), isinf()
1440 Windows build
1442 if_ole
1443 GTK3

1451, 1452, 1454, 1457, 1459, 1461, 1465, 1466, 1469-1472 channel
1453 Makefile
1455 JSON
1460, 1462 functions prototypes
1463 configure
1467 FEAT_FLOAT
1473, 1474 ifdef
1475 push_raw_key()

1476 UNUSED
1481 ifdef
1482-1485, 1493, 1496, 1501-1507, 1509, 1510, 1512, 1514, 1515, 1517-1520, 1522-1524 channel
1487 isinf()
1488 add_to_input_buf_csi()
1489 MSVC
1490, 1497, 1525 GUI GTK
1495 Compiler Warning
1498 JSON
1508 Makefile

1526, 1527, 1529-1532, 1534, 1536, 1537 channel

Included patches:
1346 #3035
1405 fix the flick in complete()
1406 #4064
1500 from neovim
1511
1757 #4509
2016-04-22 03:53:05 -04:00
5ebffaae4e Merge #3229 ':tcd' 2016-04-21 03:15:52 -04:00
cef624ee9e Merge pull request #4618 from bfredl/regcrash
eval: make sure getreg() returns a valid list for an unset register (vim-patch:7.4.1755)
2016-04-21 20:11:27 +02:00
ce17d03180 eval: let getreg() return valid list for an undefined register
vim-patch:7.4.1755
this prevents a crash when the list is used in setreg() later
2016-04-21 18:11:06 +02:00
89e6973fe2 tcd: doc, error messages 2016-04-21 03:15:08 -04:00
ec71d87b81 Implement tab-local working directory feature.
New ex commands: 'tcd', 'tchdir'
Changed Vimscript functions: 'haslocaldir', 'getcwd'

The ex-commands ':tcd' and ':tchdir' are the tab-local equivalents of
':lcd' and ':lchdir'. There are no new Vimscript functions introduced,
instead the functions 'haslocaldir' and 'getcwd' take in optional
arguments. See the documentation for details

Since there is now different levels of local directory a simple boolean
at source level is no longer sufficient; a new enumeration type is used
for the scope-level from now on.

The documentation has been accommodated for these new commands and
functional tests have been written to test the feature.
2016-04-20 12:52:31 +02:00
9e1cacecbe Fix another linter error. 2016-04-20 10:00:07 +02:00
5734e21873 delete_spec: Fix linter errors. 2016-04-20 08:25:51 +02:00
2dfc8de1cf Merge tempfile.c back into fileio.c 2016-04-20 08:25:51 +02:00
425fcdb5b4 vim-patch:7.4.1120
Problem:    delete(x, 'rf') fails if a directory is empty. (Lcd)
Solution:   Ignore not finding matches in an empty directory.

336bd622c3
2016-04-20 08:25:51 +02:00
29b737e92b vim-patch:7.4.1117
Problem:    No longer get "." and ".." in directory list.
Solution:   Do not skip "." and ".." unless EW_DODOT is set.

d82103ed85
2016-04-20 08:25:51 +02:00
a252fca38e Fix linter errors. 2016-04-20 08:25:51 +02:00
9e385404b3 vim-patch:7.4.1116
Problem:    delete(x, 'rf') does not delete files starting with a dot.
Solution:   Also delete files starting with a dot.

b0967d587f
2016-04-20 08:25:51 +02:00
88a735166b vim-patch:7.4.1114
Problem:    delete() does not work well with symbolic links.
Solution:   Recognize symbolik links.

43a34f9f74
2016-04-20 08:25:51 +02:00
50a7517a6d vim-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.

da440d21a6
2016-04-20 08:25:16 +02:00
a7a0bf54e3 Merge pull request #4610 from KillTheMule/vim-7.4.819
vim-patch:7.4.819
2016-04-20 01:36:30 -04:00
cd10cdd1b4 Merge pull request #4589 from gregorias/patch_1113
vim-patch: 7.4.1113
2016-04-20 01:34:29 -04:00
7029dec0ae vim-patch:7.4.819
Problem:    Beeping when running the tests.
Solution:   Fix 41 beeps. (Roland Eggner)

901e58c243

Applied cleanly, except for files test29.in, test4.in, test61.in, test82.in,
test83.in, test90.in, test95.in, which were all converted to lua tests, and
version.c.

Some beeps remain, but this is much better.
2016-04-19 22:01:26 +02:00
02fa6b18d6 vim-patch:7.4.1113
Problem:    Using {ns} in variable name does not work. (lilydjwg)
Solution:   Fix recognizing colon.  Add a test.
2016-04-19 19:54:52 +02:00
5c6592fdab v:windowid #4608
Set v:windowid as writeable (but read only in the sandbox).

References #3626
2016-04-19 02:49:34 -04:00
ba9bdb3e70 Merge pull request #4604 from dbarnett/vim-60cce2f
vim-patch:60cce2f
2016-04-19 01:02:25 -04:00
1cb8afed78 doc: remove redundant, outdated section.
The new content from bf635102 is retained.
2016-04-19 00:57:25 -04:00
43fe335eda vim-patch:60cce2f
Update runtime files.

60cce2fb73
2016-04-18 21:50:37 -07:00
0ba12c6691 Merge pull request #4603 from dbarnett/vim-ca63501
vim-patch:ca63501
2016-04-19 00:44:26 -04:00
0d264abdd0 vim-patch:ca63501
Update various runtime files.

ca63501fbc
2016-04-18 21:36:16 -07:00
f3d6c443d9 Merge pull request #4602 from dbarnett/vim-12969c0
vim-patch:12969c0
2016-04-19 00:29:09 -04:00
bf63510228 vim-patch:12969c0
Update documentation and syntax files.

12969c04fe
2016-04-18 21:16:14 -07:00
ef92cca7cc Merge pull request #4601 from dbarnett/vim-f913281
vim-patch:f913281 (runtime/doc/)
2016-04-19 00:09:17 -04:00
376ba4e734 Merge pull request #4599 from Shougo/fixerror
Fix loading remote plugin error
2016-04-18 23:23:13 -04:00
49dde999c0 vim-patch:f913281 (runtime/doc/)
Updated and new runtime files.

f91328100d
2016-04-18 20:15:22 -07:00
2ebc58d25a Fix loading remote plugin error 2016-04-19 06:52:04 +09:00
ba97f73560 Merge pull request #3951 from cacplate/misc1_Wconversion
Enable -Wconversion in misc1.c
2016-04-18 20:17:56 +02:00
1b1b920ba8 Merge #4553 2016-04-18 05:43:21 -04:00
a347b29aa3 test: remote/define.vim: Add some spice. 2016-04-18 05:42:27 -04:00
c4117d4b2f test: format 2016-04-18 05:40:24 -04:00
4a200ceafa test: remote/define.vim: range 2016-04-18 05:40:15 -04:00
d835c030f2 remote/define.vim: support remote function "range" 2016-04-18 05:24:46 -04:00
8d12e28d94 Merge pull request #4018 from justinmk/vim-35e7594
vim-patch:35e7594
2016-04-18 04:02:00 -04:00
05baf936c0 vim-patch.sh: recognize malformed patches.
vim-patch:fc39ecf (committed in aae7e8b)
vim-patch:541f92d (committed in cc52060)
vim-patch:88774fd (committed in 896f548)

This commit message forces vim-patch.sh to recognize these patches
which were committed with only 6 chars (vim-patch.sh requires 7).
2016-04-18 03:00:50 -04:00
8a14750dd3 test: convert test_marks.in.
vim-patch:35e7594
35e7594dd4
    "Add missing test files from 7.4.634 to the repository."

The discrepancy between the expected getpos() result of the old test
[0, 15, 2, 0] and the converted test [0, 3, 2, 0] is just a matter of how
the buffer is constructed: in the old Vim test the buffer has a bunch of
junk at the top.

The central purpose of the test is to verify that the getpost("'a") does
*not* return [0, 0, 0, 0].
2016-04-18 03:00:43 -04:00
28b9a2864a Merge pull request #4590 from Streetwalrus/issue4471
rplugin: Don't chain events.
2016-04-18 02:28:58 -04:00
e5147ce6a0 rplugin: Ignore modeline while chaining events 2016-04-18 09:21:22 +03:00
40cc5ba0e2 Merge pull request #4595 from dbarnett/vim-fc39ec
vim-patch:fc39ec (runtime/filetype.vim changes)
2016-04-18 01:54:45 -04:00
946807898b vim-patch:fc39ec (runtime/filetype.vim)
Update runtime files.

fc39ecf8de

Add remaining runtime/filetype.vim changes that were missing in 289588.
2016-04-17 22:49:49 -07:00
ca280c28b4 Merge pull request #4594 from dbarnett/vim-88774f
vim-patch:88774f
2016-04-17 20:34:49 -04:00
007d573147 Merge pull request #4131 from ZyX-I/json-functions
Add JSON support
2016-04-17 20:24:23 -04:00
896f548eee vim-patch:88774f
Updated runtime files and Italian messages.

88774fdd23
2016-04-17 17:19:00 -07:00
a3dfd1627e misc1.c: enable -Wconversion 2016-04-17 20:15:40 -04:00
ZyX
a64114eba0 functests: Make json_functions_spec use new NIL where appropriate 2016-04-18 02:48:20 +03:00
ZyX
28275fe5c3 *: Fix preincrement lint errors 2016-04-18 02:48:20 +03:00
ZyX
45304b482c eval/encode: Simplify loop in encode_list_write
Patch made up by oni-link.
2016-04-18 02:48:20 +03:00
ZyX
bda0165514 eval/encode: Make sure that encoder can encode NULL variables
Adds two undocumented v: variables: _null_list and _null_dict because I do not 
know a reproducible way to get such lists (though I think I heard about this) 
and dictionaries (do not remember hearing about them). NULL strings are obtained 
using $XXX_UNEXISTENT_VAR_XXX.

Fixes crash in json_encode($XXX_UNEXISTENT_VAR_XXX). Other added tests worked 
fine before this commit.
2016-04-18 02:48:20 +03:00
ZyX
c4f1b5a938 eval/encode: Adjust buffer sizes passed to vim_snprintf 2016-04-18 02:48:20 +03:00
ZyX
3e435df42c functests: Replace \xXX escapes with \DDD in lua code 2016-04-18 02:48:20 +03:00
ZyX
fd92e648ac eval/encode: Dump FF character correctly 2016-04-18 02:48:20 +03:00
ZyX
494b1c9bee *: Make set_vim_var_\* functions have proper argument types 2016-04-18 02:48:20 +03:00
ZyX
9af400f979 eval: Treat [] and [""] as any other empty string 2016-04-18 02:48:20 +03:00
ZyX
af7ff808c7 eval: Fix overflow in error message in f_json_decode 2016-04-18 02:48:20 +03:00
ZyX
9709cf2cdb documentation: Update assert_{false,true}() and empty() documentation
Also removes a note regarding the performance of `empty(long_list)` vs
`len(long_list) == 0` because this has nothing to do with the actual state:
first checks that list is not NULL and pointer to its first element is also not
NULL, second gets length by comparing list with NULL and falls back to
`tv->vval.v_list->lv_len` if not. `len(long_list)` *may* still be *slightly*
slower, but the slow down has nothing to do with the length of the list, is
hardly noticeable and depends on how good compiler is at inlining and what
exactly have author of the plugin written (I mean `len(long_list) == 0` vs
`empty(long_list)` vs `!len(long_list)`).
2016-04-18 02:48:20 +03:00
ZyX
25bb08dad9 api: Add warnings about the returned value to \*del_var functions 2016-04-18 02:48:20 +03:00
ZyX
4f8b686435 documentation,functests: State that UTF-8-only support is intentional 2016-04-18 02:48:20 +03:00
ZyX
c129f6cfaf eval/decode: Accept \r as space character 2016-04-18 02:48:20 +03:00
ZyX
d06c2a1b18 eval/decode: Do not overflow when parsing -
Also makes if’s less nested.
2016-04-18 02:48:20 +03:00
ZyX
2b0d46195b eval/decode: Clarify meaning of some pointer arguments 2016-04-18 02:48:20 +03:00
ZyX
0c598774d8 eval/decode: Fix typo in internal error message 2016-04-18 02:48:20 +03:00
ZyX
515fea1ef0 eval/decode: Reject even more numbers
Rejects leading zeroes and numbers like 1.e+5 (decimal dot with missing number 
with signed exponent).
2016-04-18 02:48:20 +03:00
ZyX
69ce17878e *: Fix linter errors 2016-04-18 02:48:20 +03:00
ZyX
1bada1fde0 documentation: Update type() documentation 2016-04-18 02:48:20 +03:00
ZyX
82f249f829 message: Remove useless emsg* functions, leaving only emsgf 2016-04-18 02:48:20 +03:00
ZyX
9a56fcb2e8 eval/decode: Rewrite json_decode_string end as suggested by oni-link 2016-04-18 02:48:20 +03:00
ZyX
9c543f2e24 eval/decode: Reject more numbers, accept 1e5 2016-04-18 02:48:20 +03:00
ZyX
032ac502ff eval/decode: Do not loose high surrogates followed by high surrogates 2016-04-18 02:48:20 +03:00
ZyX
eb806c9620 eval/decode: Make sure that error messages do not cause overflow 2016-04-18 02:48:20 +03:00
ZyX
52c6cc2189 eval/decode: Make sure that parsing strings does not overflow 2016-04-18 02:48:20 +03:00
ZyX
224d7df630 eval/decode: Make sure that blank input does not crash Neovim 2016-04-18 02:48:20 +03:00
ZyX
394830631f eval/decode: Make sure that U+00C3 is parsed correctly 2016-04-18 02:48:20 +03:00
ZyX
b725f6b428 functests: Make sure that json functions are tested with C messages 2016-04-18 02:48:20 +03:00
ZyX
4eb5d05f01 eval/decode: Avoid overflow when parsing incomplete null/true/false
Note: second test does not crash or produce asan errors, even though it should.
2016-04-18 02:48:20 +03:00
ZyX
4a29995fe7 eval/decode: Rename brackets in error messages
U+007D is officially RIGHT CURLY BRACKET.
U+005D is officially RIGHT SQUARE BRACKET.
2016-04-18 02:48:20 +03:00
ZyX
1fc84ae2cd eval/decode: Record that obj may be freed 2016-04-18 02:48:20 +03:00
ZyX
4ff5d6e41c eval/decode: Also use VAR_UNLOCKED in old code 2016-04-18 02:48:20 +03:00
ZyX
54cc6d8025 eval: Remove assert expression
GCC on travis thinks that
1. It is not constant.
2. Left-hand operand of comma has no effect (-Werror=unused-variable).
2016-04-18 02:48:20 +03:00
ZyX
6a35f2ac8b eval: Do not break when VimVarIndex and vimvars order mismatches
Also makes sure that compiler will error out when new name is longer then 
vv_filler.
2016-04-18 02:48:20 +03:00
ZyX
942e0b338c encode: Handle incomplete surrogates like \uSURR\uOTHR properly 2016-04-18 02:48:20 +03:00
ZyX
406562ac6d encode: Fail to dump NaN and infinity
Thanks to vim/vim#654
2016-04-18 02:48:20 +03:00
ZyX
7cdd01983a api/documentation: Add a warning that nil may mean v:null 2016-04-18 02:48:20 +03:00
ZyX
2f67786796 eval: Rename json* functions to json_* 2016-04-18 02:48:20 +03:00
ZyX
f1ced96c28 api: Replace set_var(name, NIL) with del_var(name) 2016-04-18 02:47:13 +03:00
ZyX
af6603a6b4 eval/encode: Remove unneeded variable, add missing include 2016-04-18 02:47:13 +03:00
ZyX
4913a25dec eval/encode: Free memory just in case
After string_convert() with .vc_fail=true these blocks should never be entered 
because they indicate invalid unicode.
2016-04-18 02:47:13 +03:00
ZyX
209427e972 eval/encode: Reduce length of encode_list_write
Changes suggested by oni-link.
2016-04-18 02:47:13 +03:00
ZyX
f0bd4a1494 eval/encode: Fix invalid UTF-8 strings handling:
1. Do not allow reading past buffer end when creating error messages.
2. Fix surrogate pairs range, avoid magic constants.
2016-04-18 02:47:13 +03:00
ZyX
77776b09c6 eval/encode: Fix writing strings starting with NL to list
Error [found][1] by oni-link.

[1]: https://github.com/neovim/neovim/pull/4131/files#r52239384
2016-04-18 02:47:13 +03:00
ZyX
c27395ddc8 eval: Fix QuickBuild failures
Compiler used by one VM in QuickBuild has found a number of false positives.
Everything is fine on travis.

List of failures:

From [QuickBuild][1], build [7429][2]:

    14:38:19,945 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘assert_bool’:
    14:38:19,945 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:7551:40: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
    14:38:20,058 WARN  - cc1: all warnings being treated as errors

. This is not making much sense (7551:40 is `!=` in `{SpecialVarValue} !=
({bool}?{SpecialVarValue}:{SpecialVarValue})`), but this error is present.

---

Also fail from [build][3] [4930][4]:

    15:47:00,853 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval/encode.c: In function ‘encode_read_from_list’:
    15:47:00,853 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval/encode.c:258:30: error: conversion to ‘char’ from ‘int’ may alter its value [-Werror=conversion]

, pointing to `:` in `{char} = ({char} == {const} ? {const} : {char})` where
`{const}` is character constant like `'\n'`. I have no idea where exactly it saw
conversion, so simply casted everything to (char).

---

[Build][5] error:

    08:32:03,472 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘tv_equal’:
    08:32:03,472 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:5077:1: error: control reaches end of non-void function [-Werror=return-type]

---

Build [4949][7]:

    11:28:00,578 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_type’:
    11:28:00,578 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:16085:24: error: ‘n’ may be used uninitialized in this function [-Werror=uninitialized]
    11:28:00,581 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_empty’:
    11:28:00,581 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:8505:24: error: ‘n’ may be used uninitialized in this function [-Werror=uninitialized]

[1]: http://neovim-qb.szakmeister.net/wicket/page?5-1.ILinkListener-content-buildTab-panel-masterStep-body-children-0-step-body-children-2-body-children-3-step-body-children-0-step-body-children-0-step-head-logLink
[2]: http://neovim-qb.szakmeister.net/build/4929
[3]: http://neovim-qb.szakmeister.net/build/4930
[4]: http://neovim-qb.szakmeister.net/wicket/page?1-1.ILinkListener-content-buildTab-panel-masterStep-body-children-0-step-body-children-1-body-children-3-step-body-children-0-step-body-children-0-step-head-logLink
[5]: http://neovim-qb.szakmeister.net/build/4948/step_status
[7]: http://neovim-qb.szakmeister.net/build/4949
2016-04-18 02:47:13 +03:00
ZyX
fa26eee85b version: Record that vim-7.4.1271 is kinda of there 2016-04-18 02:46:55 +03:00
ZyX
569e404622 eval/encode: Fix non-utf-8 &encoding handling, add tests 2016-04-18 02:46:34 +03:00
ZyX
7124329bd9 *: Fix memory leaks found by clang sanitizer 2016-04-18 02:46:34 +03:00
ZyX
d4106f6df3 shada: Make sure that NIL and EXT values can also be parsed back
Note: currently they are both *dumped*, but parsing them produces an error. This
is inappropriate: variables should either be skipped with error message when
dumping or should be read back properly.

It also appears that I did not have test for “has wrong variable value type”
error, so nothing got removed from errors_spec.
2016-04-18 02:46:34 +03:00
ZyX
0aa3e7b7ce eval: Port parts of 7.4.1267 that are not already present 2016-04-18 02:46:34 +03:00
ZyX
b7cb8f0597 eval: Make assert_true and assert_false accept v:true and v:false 2016-04-18 02:45:49 +03:00
ZyX
c91c0171dd *: Fix gcc warnings 2016-04-18 02:45:49 +03:00
ZyX
6cdf45e298 eval: Change dv_lock type to VarLockStatus 2016-04-18 02:45:49 +03:00
ZyX
f4ea114c67 eval/decode: Fix vim_str2nr invocation 2016-04-18 02:45:49 +03:00
ZyX
33778c36cc *: Fix linter errors 2016-04-18 02:45:49 +03:00
ZyX
6167ce6df2 eval: Remove v:none
To get v:none back just rever this commit. This will not make json*() functions
compatible with Vim though.
2016-04-18 02:45:49 +03:00
ZyX
a3b87fc19b eval: Remove get_vim_var_tv function 2016-04-18 02:45:49 +03:00
ZyX
e303ea8a19 eval/decode: Add support for special maps
Special dictionaries representing map are created when encountering duplicate
key or when key is empty or contains NUL.

Also checks that values are separated by a comma/colon properly.
2016-04-18 02:45:49 +03:00
ZyX
2c378fdfaf eval/decode: Parse strings with NUL to special dictionaries 2016-04-18 02:45:49 +03:00
ZyX
634e51d12b eval/*: Fix some linter errors 2016-04-18 02:45:49 +03:00
ZyX
57700def79 doc: Update documentation regarding converting from/to &encoding 2016-04-18 02:45:49 +03:00
ZyX
5814e29cdb eval/decode: Fix surrogate pairs processing 2016-04-18 02:45:49 +03:00
ZyX
ea82270d30 eval/decode: Fail on control and invalid unicode characters 2016-04-18 02:45:49 +03:00
ZyX
cddd7d47c3 eval/decode: Make msgpackparse() function use new v: vars 2016-04-18 02:45:49 +03:00
ZyX
ed6756563c eval/decode: Replace INIT_SPECIAL_DICT macros with inline function 2016-04-18 02:45:49 +03:00
ZyX
700b32a2b3 eval: Move some decoding functions to eval/decode.c 2016-04-18 02:45:49 +03:00
ZyX
3c39219550 eval: Get rid of VV_LEN constant 2016-04-18 02:45:49 +03:00
ZyX
85244e68e3 vim: Move *MSG* macros to message.h
Note: OUT* macros were removed because they are no longer used anywhere.
2016-04-18 02:45:49 +03:00
ZyX
41b44d114c eval: Move encode.c to eval/encode.c 2016-04-18 02:45:49 +03:00
ZyX
704accfbfa cmake: Refactor code that creates directories and lists C files 2016-04-18 02:45:49 +03:00
ZyX
e213ba1506 eval: Add jsondecode() function 2016-04-18 02:45:49 +03:00
ZyX
0f0e2bdfd4 encode: Do not use default case for v_type 2016-04-18 02:44:03 +03:00
ZyX
f5c35ba109 functests/msgpack: Test dumping special nil and bool dicts 2016-04-18 02:44:03 +03:00
ZyX
6e5498c3e3 runtime/msgpack: Add support for special values 2016-04-18 02:44:03 +03:00
ZyX
d70a322c40 eval: Add special variables v:false, v:null, v:none 2016-04-18 02:44:03 +03:00
ZyX
18903bd9b8 eval: Add special variable type 2016-04-18 02:44:03 +03:00
ZyX
256a5d2522 encode: Add a hint for static analyzer that cur_tv is not NULL 2016-04-18 02:44:03 +03:00
ZyX
68e58444b4 eval: Add jsonencode() function
Ref #3471
2016-04-18 02:44:03 +03:00
ZyX
c3efad5398 functests(msgpack): Fix location of one of the tests 2016-04-18 02:44:03 +03:00
ZyX
f21cb425fb functests(msgpack): Fix test names 2016-04-18 02:44:03 +03:00
ZyX
44cbf45d26 eval: Split out typval_T dumping functions to nvim/encode.c 2016-04-18 02:44:03 +03:00
83c683f5e1 Merge pull request #4565 from KillTheMule/vim-patch-1282
vim-patch:7.4.{1000, 1001, 1030, 1282, 1284}
2016-04-17 19:19:06 -04:00
aae7e8b7dd Merge pull request #4585 from dbarnett/vim-fc39ec
vim-patch:fc39ec
2016-04-17 18:44:25 -04:00
cc1beecf81 Merge pull request #4592 from oni-link/fix.issue.4582
eval.c: Fix heap corruption error when constructing sourcing_name
2016-04-17 18:25:43 -04:00
164bcaf5c9 eval.c: Fix heap corruption error when constructing sourcing_name
A wrong format specifier and not enough allocated memory for
sourcing_name could lead to a heap corruption.

Original patch by Rui Abreu Ferreira (@equalsraf)

Fixes #4582
2016-04-17 23:31:47 +02:00
4043725991 Merge pull request #4574 from oni-link/fix.utfc_ptr2char_len
mbyte.c: Fix invalid memory access in utfc_ptr2char_len
2016-04-17 16:59:14 -04:00
e90f52f7ac Merge pull request #4586 from oni-link/fix.on.process.exit
eval.c: Fix cut off of terminal exit message
2016-04-17 15:22:05 -04:00
cd00aa6ae4 mbyte_spec.lua: Fix indentation 2016-04-17 21:07:42 +02:00
a8fec15899 mbyte_spec.lua: Fix wording 2016-04-17 21:07:22 +02:00
4b097c85d8 Merge pull request #4579 from Shougo/lemonade
Add lemonade support for clipboard feature
2016-04-17 14:50:24 -04:00
2eb5d73438 eval.c: Fix cut off of terminal exit message
The message array in on_process_exit() is too short
for a status > 99.
2016-04-17 11:09:55 +02:00
2895883154 vim-patch:fc39ec
Update runtime files.

fc39ecf8de
2016-04-16 23:06:24 -07:00
b50afb4651 clipboard: support "lemonade" tool 2016-04-17 13:38:57 +09:00
a7a3605c0f Merge pull request #4583 from KillTheMule/robust-completion
Make completion_spec.lua more robust
2016-04-16 23:08:12 +02:00
e6e843ebc0 Make completion_spec.lua more robust
Having a tags file in the calling directory of make test would make this test
fail, so disable tag file completion for it. Disable all other options except the
current buffer, to, applying the principle of least surprise.
2016-04-16 22:40:43 +02:00
cfe4352897 mbyte.c: Unittest for utfc_ptr2char_len() 2016-04-15 21:17:33 +02:00
2c827cea12 Add new style test test_viml.vim to the build 2016-04-15 20:17:07 +02:00
1b1960ab90 Satisfy the linter 2016-04-15 20:17:07 +02:00
f09f6ba2e4 Update version.c to 7.4.1284 2016-04-15 20:17:07 +02:00
8a2cf943f7 vim-patch:7.4.1284
Problem:    Test 49 fails.
Solution:   Check for a different error message.

dc94a26a64

Applied cleanly except for version.c.
2016-04-15 20:17:07 +02:00
e34cdf6e79 vim-patch:7.4.1030
Problem:    test49 is still slow.
Solution:   Move more tests from old to new style.

a2cce86307

Applied cleanly except for version.c.
2016-04-15 20:17:07 +02:00
a0fec5d3db vim-patch:7.4.1001
Problem:    test_viml isn't run.
Solution:   Include change in makefile.

f49e240c2d

Applied cleanly except for version.c. Needs to be added to the build system.
2016-04-15 20:17:07 +02:00
622164d403 vim-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.

c06624661a

Applied cleanly except Makefile changes. File src/nvim/testdir/runtest.vim was
configured to set nocp for all tests. This option is not in nvim anymore, so it
was removed.
2016-04-15 20:17:07 +02:00
824a6877ea 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.

768ce2435a

Applied manually. Could not reproduce the crash both using vim and nvim,
therefore could not device a test.

Should be merged anyways, since it's in vim?
2016-04-15 20:17:07 +02:00
11e8ec0cac mbyte.c: Fix invalid memory access in utfc_ptr2char_len
To get an UTF-8 character, utf_ptr2char() is used.
But this function can read more than maxlen bytes, if an incomplete
byte sequence is used(first byte specifies a length > maxlen).
2016-04-15 17:35:50 +02:00
4eb58273cd Merge pull request #4558 from justinmk/filetype
defaults: Enable syntax/filetype for real.
2016-04-15 02:42:46 -04:00
523ff9c55c test: defaults_spec.lua 2016-04-15 02:23:27 -04:00
54188cddde test: move server_spec.lua
Old layout was too granular, we do not need a server/ folder.
2016-04-15 02:23:27 -04:00
cf7d6a7a0b defaults: Enable syntax/filetype for real.
Fixes a bug in #4252: we enabled filetype/syntax if -u was passed,
but not otherwise. So it did not work for an empty or missing vimrc.
2016-04-15 02:23:26 -04:00
01eafc0c17 tests: fix indeterministic oldfiles! test 2016-04-14 18:11:39 +02:00
69d74f588a Merge pull request #4566 from ZyX-I/more-lint
Add more lint checks: space before asterisk and preincrement/predecrement
2016-04-13 08:56:31 -04:00
982198143d Merge PR #4398 'Update lua client' 2016-04-13 09:24:29 -03:00
c18d5917e3 Update lua client to 0.0.1-24
The new version of the lua client uses libmpack as a backend, and some test
scripts had to be updated to reflect that.
2016-04-13 09:21:32 -03:00
ZyX
4a6328a8eb clint: Add rule for preincrement/predecrement 2016-04-13 03:06:35 +03:00
ZyX
0cb2c39ec4 clint: Add diagnostics for things like char* foo or (char*)
Asterisk should be preceded by a space except the following cases:

1. `foo[*idx_ptr]`
2. `++*foo` (though I would prefer to write this as `++(*foo)`)
3. `(*foo)->bar`, `if (*p)`
4. `char **foo`
5. `/* comment */`
6. `!*p`

Note: `[^ (*/![]` is followed by `+` to make error position easier to find. It
is not needed to find location of the problem.
2016-04-13 03:06:34 +03:00
10a8bb02ac third-party: Add missing *_host dependencies to luarocks packages 2016-04-11 23:07:52 -03:00
4ae7acd152 Add luv as a third party dependency
Luv is a simple lua binding to libuv, which is now used by neovim lua client.
The bundled luv installation a bit different from other dependencies in that it
is installed two times:

- The "BuildLuv.cmake" script downloads and installs a static version of luv
  using its normal cmake build script. This static version will be used later.
- Luv default rockspec is replaced with the alternate under the "rockspecs"
  directory(the alternate rockspec plays nicer with neovim build system)
- The alternate rockspec is used to build/install the lua module and make it
  available to lua scripts.
2016-04-11 23:07:52 -03:00
584b8eddb4 Mark cursor_spec.lua indeterministic test as pending 2016-04-11 23:07:52 -03:00
f5f11b9e2f Remove indeterminism in oldfiles_spec.lua
If Nvim is in a "Press ENTER..." screen before the `get_vvar()` call, the test
will hang.
2016-04-11 23:07:52 -03:00
3f698b8106 Allow a lua debugger to be specified on functionaltest-lua target 2016-04-11 23:07:52 -03:00
704f3dd855 Synchronize shada reset helper with other functional tests 2016-04-11 23:07:52 -03:00
906271b53d main.c: Free msgpack packer in --api-info handler to make ASAN happy 2016-04-11 23:07:51 -03:00
f47a20a266 Merge pull request #4562 from dbarnett/vim-f2571c
vim-patch:f2571c
2016-04-11 13:02:04 -04:00
cf32ca5137 vim-patch:f2571c
Updated runtime files.

f2571c61d5
2016-04-11 09:23:31 -07:00
fe4d814c0f Merge pull request #4559 from ZyX-I/undodir-undo-doc-update
documentation: Update information about default location of undo files
2016-04-11 00:08:16 -04:00
ZyX
b25b6048ca documentation: Update information about default location of undo files 2016-04-11 07:00:57 +03:00
c56aceff88 Merge pull request #4557 from mikewadsten/bugfix/issue-4537-cscope-segfault
cscope: Fix mismatched types in ':cscope show' output
2016-04-10 20:56:01 -04:00
80471df208 cscope: Fix mismatched types in ':cscope show' output
Type long on 32-bit systems is typically 32 bits, but
PRId64 is 64 bits. This mismatch leads to bad output
or segfaults on :cs show.

Fixes #4537
2016-04-10 19:11:17 -05:00
91c5005da8 Merge pull request #4555 from justinmk/spell
spell: fix SpellFileMissing handler
2016-04-10 04:52:10 -04:00
8d37201ed2 spell: Fix argument and avoid redundant prompt.
In #3027 we deferred the "missing spell file" prompt until VimEnter, but
we were sending the wrong argument (should be "en", not "en_us").
This also caused redundant prompts if user answers "No" to the download
prompt invoked by the SpellFileMissing event.

Closes #3966
Closes #4406
2016-04-10 04:27:39 -04:00
3462f46cb8 spellfile.vim: less pestering
- Always auto-create spell/ directory, don't ask.
- Don't ask where to put .spl file if only 1 choice exists.
- Always download .sug file, don't ask.
- Use blackhole register for :delete and :g//d.
- Formatting: expand tabs.
2016-04-10 04:27:25 -04:00
1bf1ffc734 Merge pull request #4505 from watiko/vim-runtimes
vim-patch:86ae720,f913281,dd1616e
2016-04-10 01:43:07 -04:00
bf2c2b34cf Merge pull request #4357 from jbradaric/vim-7.4.1105
vim-patch:7.4.1105
2016-04-09 14:14:55 -04:00
d227c843bf complete: noinsert/noselect should not set 'modified'. #4509 2016-04-09 13:36:37 -04:00
5330aa104b doc: formatting #4543 2016-04-08 18:01:07 -04:00
2df8f88b3c doc: Fix tiny typo in :bufdo section
[ci skip]
2016-04-08 17:58:14 -04:00
d44b2c9483 Merge pull request #4546 from KillTheMule/vim-patch-sh
vim-patch.sh: Fetch the whole vim repository and fix a regexp
2016-04-08 17:50:54 -04:00
e605faaa2f version bump 2016-04-08 17:26:07 -04:00
7cdbf3f97a vim-patch.sh: Fetch the whole vim repository and fix a regexp
Make get_vim_sources fetch the whole repository (it's not THAT big) so we can
pick up all the patches. The regexp didn't pick up the NA patches if there was a
comma after NA, so I extended it (I allowed arbitray things after NA, so maybe
someone can write a comment or so, should not lead to confusion).
2016-04-08 20:13:24 +02:00
f4f80a238b NVIM v0.1.3
Features:
  f2ae5a9 Add TextYankPost and TextDeletePost autocmds
  44b2cef bufhl: new mechanism for plugins to add highlights to a buffer
  39c3842 Make set{qf,loc}list() take {title}
  77a7ca4 'shortmess': Add "F" flag. #4446
  99d4c8c keymap: Support <D-...> (super/command key).

Fixes:
  14c9b30 terminal.c: temporary fix for incorrect paste handling

Notable changes:
  50e129f defaults: Enable syntax and filetype plugins.
  4e39eee upgrade libvterm (improves terminal reflow)
2016-04-07 22:04:21 -04:00
90e8bdc898 Update ISSUE_TEMPLATE.md
[ci skip]
2016-04-06 21:23:25 -04:00
666714f74f Merge pull request #4477 from Antoine-H/master
Fixed some Wconversion in charset.c
2016-04-06 15:33:57 +02:00
52a830fec6 Enabled -Wconversion in charset.c 2016-04-06 13:32:02 +00:00
47d44e00a2 Merge pull request #4269 from cacplate/pr-3667
buffer.c: change return type to bool (adoption of #3667)
2016-04-04 11:22:28 +02:00
c54ccfbb52 Merge pull request #4508 from Xerkus/hotfix/remote-plugins-wrong-condition
Fix condition for lazy loading remote plugins defintions
2016-04-03 19:20:46 -05:00
55844eee10 buffer.c: change return type to bool
Co-authored-by: Wayne Rowcliffe (@war1025)
2016-04-03 15:39:33 -04:00
c8d830e896 Merge pull request #4519 from Shougo/vim-7.4.1425
vim-patch:7.4.1425
2016-04-02 15:14:00 +02:00
1a9be28c75 vim-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)

6e722e2f94
2016-04-02 11:24:23 +09:00
28d3def5b0 Merge pull request #4083 from bfredl/oob
api/buffer: add get/set_lines with more flexible out-of-bounds handling and deprecate the line_slice functions
2016-04-01 16:56:30 +02:00
6eda7c0e5f api/buffer: deprecate old line and line slice functions 2016-04-01 11:30:00 +02:00
8eb8ebf905 tests: update tests to use [gs]et_lines instead of [gs]et_line_slice 2016-04-01 11:29:51 +02:00
f3645e422f api/buffer: add tests for buffer_[gs]et_lines 2016-04-01 11:29:51 +02:00
51c7818d42 api/buffer: introduce buffer_[gs]et_lines with new indexing convention.
-1 is index past the end, and -2 is the index of the last element.
This eliminates the need for include_start/include_end.

Allow the handling of out-of-bounds to be configurable.
2016-04-01 11:29:51 +02:00
b8643f69c1 Merge PR #4492 'vim-patch:7.4.{1641,1643,1652,1654}' 2016-03-31 19:22:38 -03:00
4b8f27338f Merge pull request #4510 from bfredl/termfix
terminal.c: temporary fix for incorrect paste handling
2016-03-31 11:43:02 -07:00
14c9b30f2e terminal.c: temporary fix for incorrect paste handling 2016-03-31 15:14:25 +02:00
6e8757255e rplugin: Fix wrong condition for lazy loading remote plugins 2016-03-31 08:58:22 +10:00
7558f42f7d vim-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 vim/vim#714)

52c6eaffd4
2016-03-30 08:30:35 -04:00
62c0d99474 vim-patch:7.4.1652
Problem:    Old style test for fnamemodify().
Solution:   Turn it into a new style test.

610cc1b9b3
2016-03-30 08:30:35 -04:00
e4d1bf7177 vim-patch:7.4.1643
Problem:    Terminating file name has side effects.
Solution:   Restore the character. (mostly by James McCoy, closes vim/vim#713)

d4caf5c16a
2016-03-30 08:30:35 -04:00
5f0c76b243 vim-patch:7.4.1641
Problem:    Using unterminated string.
Solution:   Add NUL before calling vim_strsave_shellescape(). (James McCoy)

5ca84ce4aa
2016-03-30 08:30:35 -04:00
a9e0d734d7 Merge pull request #4441 from cacplate/pr-2842 2016-03-29 16:28:18 -03:00
beccc3e3a1 vim-patch:dd1616e
Correct optwin script, update PHP complete.

dd1616e6ce
2016-03-29 23:05:51 +09:00
15b5bb038b vim-patch:f913281
Updated and new runtime files.

f91328100d
2016-03-29 21:58:28 +09:00
ce832238c8 vim-patch:86ae720
Updated runtime files.

86ae720d75
2016-03-29 21:41:37 +09:00
06b40d31c1 path.c: enable -Wconversion 2016-03-27 23:42:39 -04:00
ae686092f8 Correctly reset qf_list_T in qf_free() 2016-03-25 00:04:13 +09:00
2e2b5759cf Merge pull request #4480 from migueldvb/docs
doc: Update path to colors directory in syntax highlighting docs
2016-03-20 21:31:58 -04:00
075f84cbea Update path to colors directory in syntax highlighting docs 2016-03-20 21:22:51 -04:00
5730ad9376 Merge pull request #4461 from bfredl/pum_k_event
K_EVENT should not hide the popupmenu
2016-03-18 16:39:57 -04:00
cfcc6be73e Merge pull request #4456 from jamessan/sorted-globs
cmake: Create generated files in a consistent order
2016-03-18 16:26:32 -04:00
d61b576940 Merge pull request #4459 from fflorent/vim-7.4.1574
vim-patch:7.4.1574
2016-03-18 12:34:45 -04:00
df15f97889 vim-patch:7.4.1574
Problem:    ":undo 0" does not work. (Florent Fayolle)
Solution:   Make it undo all the way. (closes vim/vim#688)

d22e9465f6
2016-03-18 13:11:44 +01:00
5aa0159f01 edit.c: K_EVENT should not hide the popupmenu
Nor should K_FOCUSGAINED and K_FOCUSLOST.
2016-03-17 13:26:51 +01:00
6b22a742c7 Merge pull request #4431 from philix/memfile-cleanups
Review of the memfile.c API and small refactorings
2016-03-17 00:36:22 -04:00
d7511f5cde Merge #4446 2016-03-17 00:23:38 -04:00
5a9d3be54c test: minor changes 2016-03-17 00:21:48 -04:00
77a7ca458b 'shortmess': Add "F" flag. #4446
Add "Don't give the file editing message" flag in shortmess option.

Add the UI tests by @fmoralesc
Fix the changes for Vim 7.4.1570
2016-03-17 00:07:38 -04:00
3e85aee48c Review of the memfile.c API and small refactorings
- Create `mf_free_fnames()` that frees and nullifies `mf_[f]fname`
- Create `mf_set_fnames()` to set the `mf_fname` and the `mf_ffname`
  altoghether
- Have `mf_do_open` return a bool to indicate success so that calles
	don't have to check `memfile_T::mf_fd` (file descriptor)
- Inline `mf_write_block`
2016-03-16 19:12:00 -03:00
f3ac99b72d cmake: Create generated files in a consistent order 2016-03-15 14:24:38 -04:00
c94575fded Merge pull request #4418 from bfredl/remove_script_host
python: remove script_host.py that now is in neovim/python-client
2016-03-15 13:31:36 +01:00
89bb5a8ab8 python: move script_host.py to python-client 2016-03-15 12:32:18 +01:00
e7a9c006e1 Merge pull request #4168 from noahfrederick/patch-1
man.vim: parse page names containing dash or dot
2016-03-13 14:48:45 -04:00
b030c90506 Merge pull request #4440 from djrenren/nvim-in-macros
Replace vim with nvim in macros
2016-03-11 18:22:02 -05:00
ffaaf5df31 runtime/macros: replace "vim" with "nvim" 2016-03-11 16:37:25 -05:00
66a75fb835 Merge pull request #4410 from alexgenco/ruby_rplugin
Ruby remote plugin support
2016-03-11 12:33:41 -05:00
26d189e9a1 Merge pull request #4438 from bfredl/pyfindpackage
rplugin: let the python host identify packages
2016-03-11 16:56:33 +01:00
6c4d3362c5 rplugin: let the python host identify packages 2016-03-11 11:31:09 +01:00
1c066e671d rplugin: Silence :doautocmd. #4384 2016-03-11 01:22:41 -05:00
3cb9970acf Ruby remote plugin support 2016-03-10 19:01:44 -08:00
662eea8287 quickfix.c: enable -Wconversion 2016-03-10 14:24:37 -05:00
bb020df0f5 rplugin: Initialize remote plugins lazily. #4384 2016-03-10 10:34:57 -05:00
e7485ab1c9 Merge pull request #2877 from lucc/test88
test: Migrate legacy test 88.
2016-03-10 10:16:44 -05:00
316d38d98c tests: Update migrated legacy test 88 for patch 7.4.639.
The patch was merged into master at d25a59f4.
2016-03-09 23:55:16 +01:00
925c020a1b tests: Modernize legacy test 88. 2016-03-09 23:55:13 +01:00
87c208a43f tests: Migrate legacy test 88. 2016-03-09 23:54:26 +01:00
d9ecd06627 build: Specify old behavior for POLICY CMP0059.
This is needed as long as we support cmake older than 2.8.12. When we
bump the minimum version to 2.8.12, we can use target_compile_options()
and add_compile_options() instead.

Closes #4389
2016-03-09 10:25:45 -05:00
de33c9f005 Merge pull request #4409 from nhooyr/master
complete: disable folding when completing
2016-03-09 10:15:01 -05:00
0b468fd0cf complete: disable folding when completing
Fixes vim/vim#643
2016-03-09 10:04:15 -05:00
a40a4e2431 Merge pull request #4427 from nicdumz/vim-7.4.1511
vim-patch:7.4.1511
2016-03-09 01:33:14 -05:00
7bd570cd9a vim-patch:7.4.1511
Problem:    Statusline highlighting is sometimes wrong.
Solution:   Check for Highlight type. (Christian Brabandt)

af6e36ff16
2016-03-08 17:11:27 +01:00
890ce792af Merge pull request #4356 from watiko/fix-hi-normal-adjast
syntax.c: Avoid the 'background' adjustment when true color enabled
2016-03-08 09:46:57 -05:00
0e15d1cefa syntax.c: Avoid the 'background' adjustment when true color enabled 2016-03-08 21:16:04 +09:00
37b3a4c607 Merge PR #4423 'Make functional tests compatible with lua' 2016-03-07 15:20:16 -03:00
6674930d7c Add travis build for lua functionaltest 2016-03-07 14:38:46 -03:00
646ab30858 Add Lua 5.1 as a third party dep
Also add a functionaltest-lua target to run the functional tests using the lua
interpreter and corresponding helper to top-level Makefile
2016-03-07 14:38:39 -03:00
96af115c71 Normalize nan/-nan in plugin/msgpack_spec.lua
-NaN doesn't exist in the IEEE 754 spec, it is a hardware-specific detail
abstracted away by luajit(and not by lua or nvim), so there's no need to test
it.  Normalize all tests that involve -nan so the suite will be compatible with
both Lua and Luajit.
2016-03-07 13:08:48 -03:00
34a1bc1a46 Remove goto statement in lua code.
`goto` is another luajit extension not compatible with 5.1.
2016-03-07 03:58:35 -03:00
c6ec148f2d Rewrite hexadecimal escape sequences as decimal in lua strings
The hexadecimal notation is a Luajit extension which is not compatible with Lua
5.1. While Lua 5.2 does support hexadecimal sequences, it is better to target
Lua 5.1 for maximum compatibility with Luajit(which has fully compatible with
5.1 API/ABI).
2016-03-07 03:58:35 -03:00
35d8d10a6a Remove dependency on ffi module 2016-03-07 03:58:29 -03:00
bd81239f2f Merge pull request #4324 from watiko/vim-7.4.973
vim-patch:7.4.973
2016-03-05 18:00:08 -05:00
1895f6ffab Merge pull request #4415 from oni-link/fix.leak
ex_eval: Fix memory leak
2016-03-05 15:05:44 -05:00
2ea02ff635 ex_eval: Fix memory leak
Parameter should_free, indicating that the caller has to  free the
returned pointer from get_exception_string(), is not set to true if
type == ET_ERROR.
2016-03-05 20:46:59 +01:00
3d9e9a92cf vim-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.

6f62fed349
2016-03-06 00:03:46 +09:00
43456e43de ex_getln.c: Enable middle click pasting in command mode 2016-03-06 00:03:46 +09:00
091ef2fbe4 man.vim: prefer cmd-line to normal-mode commands 2016-03-05 09:12:54 -05:00
42e710eacb man.vim: clean up regex/string comparisons
- Explicitly specify case sensitivity when comparing strings
- Clean up unnecessarily complex `if` statements
2016-03-05 09:12:54 -05:00
9fb9d2929f man.vim: fixes to argument handling and parsing
- Define a collection of legal characters when parsing page and section
  in `s:parse_page_and_section()` instead of relying on 'iskeyword',
  which is unreliable.
- Allow non-numeric section names (e.g., `3c`).
- Simplify argument handling in `man#get_page()` to accommodate
  non-numeric section names.

Fixes #4165.
2016-03-05 09:12:54 -05:00
0e9f7a7b36 Merge pull request #4412 from justinmk/libvterm
deps: upgrade libvterm
2016-03-04 20:46:52 -05:00
4e39eee13c deps: upgrade libvterm
New feature: `VTermState->mode.bracketpaste`
  Enabled by default, but note that `vterm_state_reset()` disables it.
  03981def6b
References #3476

New feature: `vterm_state_set_unrecognised_fallbacks`
  acf7f19713

Oh, and terminal reflow works now.
Closes #2514 (but not #3864, that's a bit more tricky)
2016-03-04 20:13:46 -05:00
8991b4b095 Merge pull request #4320 from watiko/vim-7.4.958
vim-patch:7.4.958
2016-03-04 13:12:59 -05:00
c2c180fbb3 Merge pull request #4401 from mhinz/help-term-startinsert
Doc: autocmd for always switching to insert mode (:term)
2016-03-04 10:09:04 -05:00
03fe4ad9b1 Doc: switch to terminal mode automatically 2016-03-04 12:55:59 +01:00
ed1925e0d1 Lint: fix line length >80
Introduced here:

4bfac00aa3 (diff-2bf87eef9f7b99dcea4b0c55beee2d63R78)
2016-03-04 12:23:21 +01:00
c3b6cd300f Merge pull request #4402 from jbradaric/vim-7.4.1141
vim-patch:7.4.1141
2016-03-03 23:39:58 -05:00
fb4655beb1 Merge pull request #4390 from justinmk/clangformat
clang-format configuration
2016-03-03 23:37:18 -05:00
4bfac00aa3 Windows: XDG: Update default paths. #4403
The previous defaults were including the nvim suffix, causing it to
apear twice in the final paths.

kXDGDataHome and kXDGConfigHome are now set as %LOCALAPPDATA%,
kXDGCacheHome is set as $TEMP.

In Windows there is no distinction between configuration and data
storage, but we don't want to place all files under the same path.
get_xdg_home() now appends a different path suffix for kXDGDataHome.

- Configuration files are saved under %LOCALAPPDATA%\nvim
- Data files are saved under %LOCALAPPDATA%\nvim-data
2016-03-03 23:26:11 -05:00
75fbc23ead vim-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)

6773a348da
2016-03-03 22:34:26 +01:00
c6df1b387c clang-format configuration
Recommend by oni-link at:
https://github.com/neovim/neovim/pull/487#issuecomment-39935391
2016-03-02 23:56:38 -05:00
32238018e4 Merge PR #4375 'Proper type checking for set{qf,loc}list()' 2016-03-02 15:55:58 +01:00
67eeb8a798 Tests: check error messages from set{qf,loc}list() 2016-03-02 15:09:39 +01:00
53aa569918 Proper type checking for set{qf,loc}list()
Prior to this change, type errors were silently ignored. They're explicit now.

  setqflist(list, action, title)
  setloclist(win, list, action, title)

"list" (required) must be a list.
"action" (optional) must a string.
"title" (optional) must a string or number that gets converted to a string.

An error is thrown otherwise.
2016-03-02 15:06:37 +01:00
5ef3e40b37 edit.c: change return type to bool
Co-authored-by: Wayne Rowcliffe (@war1025)
2016-03-02 08:37:19 -05:00
9d1e076056 Merge PR #4388 'Clean up tests' 2016-03-02 12:37:58 +01:00
a528d56ba0 Tests: add autocmd_spec.lua 2016-03-02 12:37:50 +01:00
d9e631f1b5 Tests: clean up tabnew_spec.lua 2016-03-02 12:37:50 +01:00
55c0621ff3 vim-patch:7.4.958
Problem:    Vim checks if the directory "$TMPDIR" exists.
Solution:   Do not check if the name starts with "$".

e1a61991d9

---

see: "$TMPDIR bug"
     https://groups.google.com/d/msg/vim_dev/UWjbjOf9tEY/wfwnkh41AwAJ
2016-03-02 15:51:39 +09:00
576c5f7b74 Merge pull request #4323 from watiko/vim-7.4.961
vim-patch:7.4.961
2016-03-02 01:48:21 -05:00
badf227e6f Merge pull request #4319 from watiko/vim-7.4.952
vim-patch:7.4.952
2016-03-02 01:31:45 -05:00
56bfdd7934 Merge #4265 'vim-patch:7.4.925'. 2016-03-02 01:24:38 -05:00
36cb847d09 Merge #4231 'vim-patch:7.4.857'. 2016-03-02 01:08:38 -05:00
be7d6ba6c1 Trigger TabNew before TabEnter 2016-03-01 21:52:37 +01:00
c00da817c4 Merge PR #3657 'Correct max numbers of args for some functions' 2016-03-01 18:06:35 +01:00
6bfd88dec1 Tests: add function_spec.lua 2016-03-01 17:07:18 +01:00
e76bc505e9 Correct max numbers of args for some functions
Closes #3650.
2016-03-01 17:06:59 +01:00
2ee37cc285 Fix :%s/\n//
Fixes #4352.
2016-03-01 02:06:05 +01:00
888b8abeb0 Doc: make definitions jumpable
References #3640.
2016-02-29 16:33:39 +01:00
1dd986562f Merge pull request #4304 from bfredl/yank
Add v:event variable and TextYankPost autocommand
2016-02-29 16:09:28 +01:00
e17e5547d7 clint.py: a function name starting with for is not a for statement 2016-02-29 16:07:50 +01:00
c1487b9685 ops.c: breakout shared register type formatting code 2016-02-29 16:07:50 +01:00
2359f6f144 TextYankPost: add information to v:event and update tests 2016-02-29 16:07:50 +01:00
7ab9ff88e6 eval: add v:event, which will contain data events want to propagate to their receivers.
Add helper functions dict_clear and dict_set_keys_readonly.
2016-02-29 16:06:41 +01:00
88da85a3cd Tests: fix according to lualint 2016-02-29 13:48:59 +01:00
f2ae5a9cc0 Add TextYankPost and TextDeletePost autocmds
Reviewed by @watiko

Ported from de53ab72c8
2016-02-29 13:21:59 +01:00
9c4b34be28 Merge pull request #4373 from justinmk/qfcrash
qf_fill_buffer: Avoid buffer overflow.
2016-02-28 20:15:02 -05:00
0c5f74ae4d coverity/56808: STRING_OVERFLOW
This was caught by FORTIFY_SOURCE (and coverity).

Fixes #4371
2016-02-28 19:19:34 -05:00
0c2ba7554f Merge pull request #3900 from ZyX-I/inf-nan-string
Make it possible to eval() all floating-point values dumped by string()
2016-02-28 11:48:54 -05:00
8ade191b7a Merge pull request #4364 from ZyX-I/proper-e-term
Replace hack used to run TermOpen with nested modifier
2016-02-28 11:46:04 -05:00
9d41060c32 Merge pull request #4289 from phanimahesh/refactor/wconversion/ex_cmds2.c
Enable -Wconversion for ex_cmds2.c
2016-02-28 11:21:21 +01:00
de7165d351 eval: Update documentation.
Extracted from vim-patch:da440d21a6b94d7f525fa7be9b1417c78dd9aa4c
2016-02-28 10:38:45 +01:00
ZyX
0409cfded5 functests: Improve screen:expect error reporting 2016-02-28 08:15:52 +03:00
ZyX
a16d4a2b62 functests: Make test more robust 2016-02-28 08:12:55 +03:00
ZyX
712f057ed9 functests: Make sure that setting scrollback size works from TermOpen 2016-02-28 07:34:36 +03:00
ZyX
92d4dfdca5 ci: Disable -Wc11-extensions on FreeBSD
Closes #4363.
2016-02-28 06:58:47 +03:00
ZyX
c6eeefa339 main: Move term:// protocol name to a macros 2016-02-28 06:29:38 +03:00
ZyX
b32396170f main: Make using :edit term:// run TermOpen event
Ref #4306
2016-02-28 04:54:23 +03:00
ZyX
a1493215a2 Revert "Merge pull request #4362 from justinmk/termopen"
This reverts commit b01db02de4, reversing
changes made to 62321e5132.
2016-02-28 04:34:27 +03:00
b01db02de4 Merge pull request #4362 from justinmk/termopen
term: publish TermOpen in "e term://" handler.
2016-02-27 19:08:41 -05:00
62321e5132 Merge pull request #4358 from jbradaric/vim-7.4.1112
vim-patch:7.4.1112
2016-02-27 19:08:28 -05:00
ba1348edc5 Merge pull request #4361 from watiko/vim-nas
version.c: Mark vim-patches NA
2016-02-27 18:25:53 -05:00
0f604e1da2 version.c: Mark vim-patches NA
NA patch list:
  892: (MS-Win, iconv)
       9d6ca1cc5e

  904: ({,g}vim.desktop)
       6407b3e80d
       1d8d9c0bec
       vim-patch:1d8d9c0bec84ac799a2f62a5ac81eade3eaf638a

  905: (if_py_both)
       d424747d58

  909: (src/Makefile)
       de59ba33aa

  914: (src/term.c, logical-not-parentheses)
       98b30a473a

  943: (src/testdir/Makefile, test_writefile)
       48a969b488

  947: (src/testdir/Make_ming.mak, Test_listchars)
       5311c02f25

  956: (empty) Missing parts are in other runtime comitts.
       f882d9f89d

  969: (cast) HAVE_AVAIL_MEM was removed.
       35be4534c0

  993: (if_py_both)
       52f6ae1366

Already merged patch list:
  vim-patch:35e7594dd429f7a8a06cefd61c3e8d48b9bd74e2
  vim-patch:44132a10aeb45c957959cafb4ac39d3f478be98c
  vim-patch:974
2016-02-28 05:42:41 +09:00
2af36df86d eval: Fix linter error. 2016-02-27 19:05:30 +01:00
8d5e60d8af vim-patch:7.4.1112
Problem:    When using ":next" with an illegal file name no error is reported.
Solution:   Give an error message.

2db5c3b3ce
2016-02-27 18:47:04 +01:00
2ab9e96742 ex_cmds2.c:style: silence clint after -Wconversion changes
use ///< to document all struct and enum fields
2016-02-27 23:08:41 +05:30
a6d0e3696c enable -Wconversion for ex_cmds2.c 2016-02-27 23:08:29 +05:30
11cf3680e4 vim-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)

9bbf63dbf8
2016-02-27 18:29:16 +01:00
3e0fab6b7c Merge pull request #4332 from Jun-T/editorconfig
.editorconfig
2016-02-27 10:42:53 -05:00
b6170db1a1 Avoid internal errors with setloclist()
All syntastic users experienced this problem:

  E685: Internal error: get_tv_string_buf()

It's reproducable with:

  :call setloclist(0, [''])

So, not given optional arguments to setloclist() lead to some fields not
inizilied and the code took the wrong branches.
2016-02-26 18:52:17 +01:00
23f8696317 Merge pull request #4277 from Jun-T/lang2locale
build: install *.mo into the "standard" directory
2016-02-26 10:24:48 -05:00
bb56564900 Merge pull request #4335 from HarmtH/update-doc
Correct documention on order autocmds
2016-02-25 10:36:51 -05:00
1abad9978f Merge pull request #4274 from DarkDefender/patch-1
Adjust terminal text color if it is bold
2016-02-25 10:35:04 -05:00
79d30bab54 Merge pull request #4346 from bfredl/minilint
build system: allow linting a single file and revert #4216
2016-02-25 10:24:52 -05:00
3402d07abe Merge PR #4337 'Make set{qf,loc}list() take {title}' 2016-02-25 13:15:33 +01:00
97324c96a4 Tests: add errorlist_spec.lua 2016-02-25 12:50:17 +01:00
39c3842621 Make set{qf,loc}list() take {title}
Add an extra argument to these functions to set w:quickfix_title.

This is a modified version of a patch from vim_dev. Discussion here:

  https://groups.google.com/forum/#!topic/vim_dev/X7VVPd4Do5s

Credits go to Christian "chrisbra" Brabandt and Daniel "blueyed" Hahler.
2016-02-25 12:50:12 +01:00
281a9b2cea Revert "build system: avoid more unneccesary recompiles"
This was not the correct way to fix the issue.
2016-02-25 11:36:56 +01:00
5c1597cad1 cmake: allow linting a specific file
For instance to only lint "edit.c"
make lint LINT_FILE="src/nvim/edit.c"
2016-02-25 11:31:34 +01:00
8160e875a0 Merge pull request #4339 from philix/fix-undo-diagram
Fix the ASCII-art diagram in undo.c
2016-02-24 08:55:07 -05:00
78ded07954 Fix the ASCII-art diagram in undo.c
Set \t to 8 spaces and `retab`.
2016-02-24 02:14:23 -03:00
9a3b7fa906 Tests: fix according to lualint 2016-02-24 01:42:38 +01:00
72d9d5e917 term: publish TermOpen in "e term://" handler.
After 87a49405b0, terminal_open() is not
nested by default. The default "term://" handler depended on that, but
it should instead explicitly raise TermOpen.

References #4306
2016-02-23 19:10:54 -05:00
b10c9b4f5b Merge pull request #1817 from bfredl/bufmatch
support buffer-associated highlighting by external plugins
2016-02-23 23:32:21 +01:00
2a4ea9a546 docs: start api docs and document highlight mechanism 2016-02-23 21:29:02 +01:00
3b1800be94 bufhl: fix unittests and lint
msgpack_rpc_dispatch doesn't exist anymore
2016-02-23 21:29:02 +01:00
06b9d2a6f2 bufhl: add tests for adding and clearing highlights 2016-02-23 21:29:01 +01:00
44b2cef83a bufhl: new mechanism for plugins to add highlights to a buffer 2016-02-23 21:29:01 +01:00
18605d6785 Merge pull request #4327 from ffleming/coverity-71530
coverity/71530: Prefer STRLCPY to STRCPY in option.c
2016-02-23 14:51:41 -05:00
b25dfecb18 Merge pull request #4329 from justinmk/libuv
Update to libuv 1.8.0
2016-02-23 14:37:48 -05:00
5993a38ba3 Merge pull request #4064 from oni-link/cs_print_tags_priv
Fix some problems with cs_print_tags_priv()
2016-02-23 14:36:40 -05:00
7feef42e8a coverity/71530: Prefer STRLCPY to STRCPY in option.c
Addresses Coverity CID 71530

Prefer sizeof(NameBuff)

Add braces for Travis lint

Break long line

Properly align parameters in multi-line function call
2016-02-23 08:27:27 -08:00
564f57d1e5 Fix terminal true color bold colors
Now the terminal should also correctly output true color codes
2016-02-23 16:15:47 +01:00
f57b9c57df Correct documention on order autocmds
The order of executed autocmds TabEnter and WinEnter is wrongly stated
in the documentation. TabEnter is executed after WinEnter.
2016-02-23 12:24:43 +01:00
47b5294b0f Merge pull request #4330 from justinmk/set_vim_var_dict
set_vim_var_dict: Allow NULL `val`.
2016-02-23 04:27:52 -05:00
ac1f941edb add .editorconfig 2016-02-23 18:03:27 +09:00
5c09d5c3de set_vim_var_dict: Allow NULL val.
Closes #3006
2016-02-23 02:56:40 -05:00
6f833c7881 Merge pull request #4328 from justinmk/coverity
coverity/71532: STRING_OVERFLOW
2016-02-23 00:13:13 -05:00
1a15cf84c2 build: install *.mo into the "standard" directory
Change POROJECT_NAME to 'nvim', and use it as the gettext
domain name. The *.mo files, previously installed as
$runtime/lang/xx/LC_MESSAGES/nvim.mo, are now installed as
$prefix/locale/xx/LC_MESSAGES/nvim.mo.
2016-02-23 13:39:56 +09:00
62cf44b8ab Update to libuv 1.8.0 2016-02-22 19:28:52 -05:00
9b99cf4a6e coverity/71532: STRING_OVERFLOW 2016-02-22 19:16:55 -05:00
37d6004251 Merge pull request #4315 from justinmk/compl_flicker
completion: Avoid flicker
2016-02-22 14:05:33 -05:00
63606bb409 vim-patch:7.4.961
Problem:    Test107 fails in some circunstances.
Solution:   When using "zt", "zb" and "z=" recompute the fraction.

9dc2ce398b
2016-02-23 01:19:10 +09:00
c8b574f749 ins_complete: Avoid semi-global state. 2016-02-22 10:00:05 -05:00
faf828b476 Merge pull request #4318 from lucc/legacy_test_makefile
test: Reformat legacy test makefile.
2016-02-22 09:13:40 -05:00
f0add77de5 vim-patch:7.4.952
Problem:    'lispwords' is tested in the old way.
Solution:   Make a new style test for 'lispwords'.

6cd1345307
2016-02-22 22:47:18 +09:00
94b1403ad5 test: Reformat legacy test makefile.
This will hopefully reduce the number of merge conflicts when merging the
outstanding legacy test migrations.
2016-02-22 13:02:41 +01:00
e71de26aba Merge pull request #4317 from justinmk/superkey
keymap: Support <D-...> (super/command key).
2016-02-22 04:25:34 -05:00
99d4c8c29c keymap: Support <D-...> (super/command key).
Adds support for:
  - api:vim_input("<D-a>")
  - ":nnoremap <C-D-S-...>" and permutations thereof

UIs must capture the modifier and send it as "<D-...>" to vim_input().

Note: Before this commit, any arbitrary ":nnoremap <{foo}-{bar}>"
mapping could already be invoked with feedkeys("\<{foo}-{bar}>"). This
commit supports "D-" as a modifier that can be combined with "C-", "A-",
"S-" in any order.

For non-GUI (terminal) support, user must:
  :set <D-a>={CSI sequence}
then send the {CSI sequence} from their terminal. But this does not work
yet (regression #2204).

Closes #2190
2016-02-22 02:41:40 -05:00
9403ce82bc vim-patch:7.4.936 #4271
Problem:    Crash when dragging with the mouse.
Solution:   Add safety check for NULL pointer. Check mouse position for valid
            value. (Hirohito Higashi)

294a7e55b0

---

see: "Crash while mouse-selecting in two-buffer mode"
     https://github.com/vim/vim/issues/486

Fix #3704
2016-02-22 01:12:47 -05:00
bfe9ebcbe1 Merge pull request #4272 from watiko/vim-7.4.937
vim-patch:7.4.937
2016-02-22 01:11:42 -05:00
95230ec702 Merge pull request #4267 from watiko/vim-7.4.932
vim-patch:7.4.{926,932,933}
2016-02-22 01:10:50 -05:00
44179d7444 Merge pull request #4263 from watiko/vim-7.4.901
vim-patch:7.4.901
2016-02-22 01:03:51 -05:00
73676ad37b Merge pull request #4262 from watiko/vim-7.4.893
vim-patch:7.4.{891,893,912}
2016-02-22 01:02:18 -05:00
2eb09c826d vim-patch:7.4.878 #4258
Problem:    Coverity error for clearing only one byte of struct.
Solution:   Clear the whole struct. (Dominique Pelle)

69b67f7e77
2016-02-22 00:51:13 -05:00
2f98888db6 Merge pull request #4310 from jbradaric/vim-7.4.939
vim-patch:7.4.939
2016-02-22 00:48:54 -05:00
f08fd41282 Merge pull request #4250 from jbradaric/vim-7.4.895
vim-patch:7.4.895
2016-02-22 00:45:51 -05:00
9e00724c38 Merge pull request #4307 from jbradaric/vim-7.4.870
vim-patch:7.4.870
2016-02-22 00:41:55 -05:00
609dad3799 Revert "Enable link-time optimisations on Release build."
This reverts commit 1132b67b5b.
See https://github.com/neovim/neovim/pull/4313#discussion_r53570725
2016-02-22 00:37:16 -05:00
d9291954b9 Merge pull request #4259 from watiko/vim-7.4.881
vim-patch:7.4.{879,881}
2016-02-22 00:34:24 -05:00
6395dd64a4 Merge pull request #4167 from lucc/test11
tests: migrate legacy test 11
2016-02-21 23:49:36 -05:00
dd4b661dbd Merge pull request #4243 from lucc/test36
tests: Migrate legacy test 36.
2016-02-21 23:47:15 -05:00
d92db14241 completion: Avoid flicker. 2016-02-21 15:58:38 -05:00
d4778104b5 Merge pull request #4079 from fwalch/vim-patch/review-improvements
vim-patch.sh: Improvements for review functionality, submission option.
2016-02-21 15:33:21 -05:00
44166a150c Merge pull request #4314 from justinmk/mksession_terminal
mksession: Restore buftype=terminal windows.
2016-02-21 15:22:05 -05:00
81b68b0af3 Merge pull request #4247 from watiko/vim-7.4.903
vim-patch:7.4.{831,832,845,903}
2016-02-21 15:21:53 -05:00
4bd848f24f mksession: Restore buftype=terminal windows.
Closes #4311
2016-02-21 14:42:31 -05:00
ZyX
90cbd70d1a documentation: Add notes to eval.txt and vim_diff.txt 2016-02-21 21:58:58 +03:00
09e4c244ee Merge pull request #4313 from Yamakaky/flto
Enable link-time optimisations on Release build.
2016-02-21 13:14:57 -05:00
1132b67b5b Enable link-time optimisations on Release build.
Fixes https://github.com/neovim/neovim/issues/3136
2016-02-21 18:33:28 +01:00
693bf1dafb path.c: Fulfill the @returns conditions
Original-author: oni-link <knil.ino@gmail.com>
2016-02-21 22:07:42 +09:00
d6c894efaf vim-patch:7.4.903
Problem:    MS-Windows: When 'encoding' differs from the current code page,
            expandinig wildcards may cause illegal memory access.
Solution:   Allocate a longer buffer. (Ken Takata)

7314efd87d
2016-02-21 22:06:39 +09:00
6bbd149e98 vim-patch:7.4.845
Problem:    Compiler warning for possible loss of data.
Solution:   Add a type cast. (Erich Ritz)

5df1ed2de3
2016-02-21 22:06:39 +09:00
6ea1047585 vim-patch:7.4.832
Problem:    $HOME in `=$HOME . '/.vimrc'` is expanded too early.
Solution:   Skip over `=expr` when expanding environment names.

be83b73ddb

---

To reproduce:

```sh
nvim -u NONE -c 'e `=$HOME . "/.vimrc"`'
```
2016-02-21 22:06:39 +09:00
c8561ecf26 vim-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.

3f188935ec
2016-02-21 22:06:23 +09:00
82293b94c3 ex_docmd: Fix code style in ex_match 2016-02-21 11:21:45 +01:00
29b393e43a vim-patch:7.4.939
Problem:    Memory leak when encountering a syntax error.
Solution:   Free the memory. (Dominique Pelle)

9a7d58e42e
2016-02-21 11:15:08 +01:00
fc51f86b72 Merge pull request #4296 from mhinz/fix-termclose
Make TermClose event return the associated buffer
2016-02-21 02:04:13 -05:00
6732f0193a Tests: check <abuf> from TermClose 2016-02-21 02:39:01 +01:00
fe8b2fabe7 Make TermClose event return the associated buffer
<abuf> from the TermClose event now returns the correct buffer number.

Prior to this change it would always return the buffer number of the current
buffer, which is obviously wrong in an async environment.
2016-02-21 02:38:55 +01:00
51055c14a6 Merge pull request #4306 from justinmk/termau
terminal_open: do not force autocmds
2016-02-20 16:02:50 -05:00
5b263ac6ad vim-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)

2455c4ede8
2016-02-20 19:15:13 +01:00
44024f2c65 Merge #4249 'tests: migrate charsearch' 2016-02-20 10:52:18 -05:00
1b8caf3d75 test: charsearch: Fix error/typo in legacy test.
Error was reported upstream in vim/vim#650, fixed in 7.4.1366.
Typo was fixed upstream in 7.4.1041.
2016-02-20 10:52:02 -05:00
4a02dc0828 tests: Remove old charset test after migration. 2016-02-20 07:57:55 +01:00
76c9bd00d0 tests: Migrate legacy charsearch test. 2016-02-20 07:53:37 +01:00
3e3db580fd Merge pull request #4298 from tomxtobin/fix-help-typo
doc: Remove stray "<" in options help
2016-02-19 23:16:17 +01:00
af67f022ca Merge pull request #4264 from watiko/vim-7.4.922
vim-patch:7.4.922
2016-02-19 22:07:46 +01:00
e87c7fcb39 Remove stray "<" in options help
Normally this would end an example, but there's no example block here.
2016-02-19 14:13:17 -05:00
00347ec781 Merge pull request #4240 from jbradaric/vim-7.4.888
vim-patch:7.4.888
2016-02-19 04:06:29 -05:00
87a49405b0 terminal_open: do not force autocmds 2016-02-19 03:03:11 -05:00
12938b82fb Merge pull request #4294 from justinmk/coverity
coverity
2016-02-19 02:38:42 -05:00
156df2c81b coverity/135593: Error handling issues (CHECKED_RETURN)
Harmless issue (HI): retval is intentionally ignored, as is the wont of
didset_options() and friends.
2016-02-19 02:00:23 -05:00
06e53aa487 coverity/135589: (FP) Null pointer dereferences
False positive: buflist_findnr() should not be NULL in this case because
it is given a buffer number that (should be) guaranteed to exist.
2016-02-19 02:00:22 -05:00
91254bd9d8 Merge pull request #4280 from mhinz/add-issue-template
Add ISSUE_TEMPLATE.md
2016-02-18 18:33:16 -05:00
a6a6f70128 Add ISSUE_TEMPLATE.md
This is a new Github feature:

  https://github.com/blog/2111-issue-and-pull-request-templates
2016-02-19 00:28:36 +01:00
f887037a8f Merge pull request #4276 from justinmk/coverity135578
coverity/135578: Memory - illegal accesses
2016-02-17 10:45:24 -05:00
0d6cd2b808 option_defs.h: Introduce SHM_ABBREVIATIONS
Helped-by: ZyX <kp-pav@yandex.ru>
2016-02-17 21:04:24 +09:00
5b63488c25 option_defs.h: Fix "set shm+=a" 2016-02-17 21:04:20 +09:00
0b67bb8c25 option_defs.h: Improve coding style 2016-02-17 21:04:20 +09:00
4612821946 vim-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 vim/vim#470)

a0ed84a268
2016-02-17 21:04:20 +09:00
498eb02049 Merge pull request #4239 from jbradaric/vim-7.4.885
vim-patch:7.4.885
2016-02-17 04:31:21 -05:00
bd7de9dac9 vim-patch:7.4.859 #4238
Problem:    Vim doesn't recognize all htmldjango files.
Solution:   Recognize a comment. (Daniel Hahler, PR #410)

d8986fd914
2016-02-17 04:28:01 -05:00
e4e5815242 Merge pull request #4244 from watiko/vim-7.4.830
vim-patch:7.4.{830,833}
2016-02-17 04:26:29 -05:00
b2b3768bb4 Merge pull request #4234 from watiko/vim-7.4.977
vim-patch:7.4.{818,883,977}
2016-02-17 04:10:50 -05:00
af1745a763 Merge pull request #4230 from jbradaric/vim-7.4.853
vim-patch:7.4.{853,856}
2016-02-17 04:08:57 -05:00
9198b06ea6 Merge pull request #4229 from jbradaric/vim-7.4.847
vim-patch:7.4.847
2016-02-17 04:04:27 -05:00
560a346d57 vim-patch:7.4.844 #4228
Problem:    When '#' is in 'isident' the is# comparator doesn't work.
Solution:   Don't use vim_isIDc(). (Yasuhiro Matsumoto)

37a8de17d4
2016-02-17 03:59:58 -05:00
5f54519b4f Merge pull request #4213 from jbradaric/vim-7.4.835
vim-patch:7.4.{835,843,877}
2016-02-17 03:49:57 -05:00
6dc39d84cf Merge pull request #4188 from jbradaric/vim-7.4.868
vim-patch:7.4.868
2016-02-17 03:45:12 -05:00
e65fce8ed3 vim-patch.sh: Replace #<number> with vim/vim#<number> in commit messages. 2016-02-17 00:18:19 +01:00
cc6299ecbc vim-patch.sh: Support multi-patch pull requests.
* Calling "vim-patch.sh -p" on a checked-out branch already created with
  "-p" will re-use the branch and append commits.

* Fetch upstream/master before checking out branch on first call of "-p".

* Reverted creation of commit in submit step ("-s") to previous behavior:
  Create an empty commit with correct commit message when "-p" is called.

* Submitting a pull request with "-s" will create a correct pull request
  message even if multiple patches have been ported in one single branch
  with "-p".
2016-02-17 00:18:19 +01:00
775a16b0b7 vim-patch.sh: Add -s (submit pull request) option.
When calling "vim-patch.sh -s" on a checked-out branch created with
"vim-patch.sh -p", create commit from staged changes, push to origin,
create pull request (using hub), and clean up patch files.
2016-02-17 00:18:19 +01:00
07eabc062e vim-patch.sh: Use .patch files only. 2016-02-17 00:18:19 +01:00
b768d8a09c vim-patch.sh: Improvements for review functionality.
* Support pull requests with multiple commits.
 * Offer to clean up files after review.
 * Always use full commit hash in assign_commit_details().
2016-02-17 00:18:19 +01:00
db20edef69 vim-patch:7.4.937
Problem:    Segfault reading unitialized memory.
Solution:   Do not read match \z0, it does not exist. (Marius Gedminas, closes
            vim/vim#497)

5ad075c073
2016-02-17 03:00:13 +09:00
c9f4f828d5 version.c: Mark 7.4.935 NA
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.

6040256d8b

---

feedkeys() is not used by legacy test utf8.
2016-02-16 22:56:47 +09:00
9036f1644f vim-patch:7.4.933
Problem:    Crash when using longest completion match.
Solution:   Fix array index.

e4eda3bc71
2016-02-16 22:56:02 +09:00
9648bf795a coverity/135578: Memory - illegal accesses
Harmless issue, but doesn't hurt to satisfy coverity here.
2016-02-16 04:25:59 -05:00
30b452b470 ex_docmd: Don't use pre-increment. 2016-02-16 07:20:47 +01:00
3b34c992bc vim-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)

23d1b62746
2016-02-16 07:18:48 +01:00
5af9ae9e60 Merge pull request #4171 from cacplate/pr-3694
diff.c: change return type to bool (adoption of #3694)
2016-02-15 23:07:31 +01:00
089368c15f Doc: correct default value 2016-02-15 19:55:51 +01:00
b3bdf9f356 diff.c: change return type to bool
Co-authored-by: Wayne Rowcliffe (@war1025)
2016-02-15 12:41:08 -05:00
4f3ea0379e vim-patch:7.4.932
Problem:    test_utf8 has confusing dummy command.
Solution:   Use a real command instead of a colon.

8f08dab18d
2016-02-16 00:18:42 +09:00
3680332325 vim-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)

4f8fa1633c
2016-02-16 00:15:52 +09:00
d4bb84367f vim-patch:7.4.922
Problem:    Leaking memory with ":helpt {dir-not-exists}".
Solution:   Free dirname. (Dominique Pelle)

1c2836e268

---

see: "[patch] command :helpt {dir} leaks memory when directory does not exist"
     https://groups.google.com/d/msg/vim_dev/WbcIbZ9YdUA/4eow2c3_AgAJ
2016-02-15 22:38:19 +09:00
4a4c3fdfcd vim-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)

e7d1376b63

---

see: "[bug] [patch] Setting foldmethod in WinLeave autocommand can corrupt undo state"
     https://groups.google.com/d/msg/vim_dev/xF5uMLb1vwY/Jn4RglosDgAJ
2016-02-15 22:28:45 +09:00
ade2298735 vim-patch:7.4.912
Problem:    Wrong indenting for C++ constructor.
Solution:   Recognize ::.  (Anhong)

e01f4f86ce
2016-02-15 21:08:22 +09:00
72d5a88af5 vim-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.

d1b15dec4d
2016-02-15 19:13:15 +09:00
1eeadd7098 test: Fix lint error 2016-02-15 11:05:17 +01:00
9bd8fcde1e test: Add test cases to legacy test autocmd_option 2016-02-15 11:05:17 +01:00
b535df1554 eval: Fix linter error. 2016-02-15 11:05:17 +01:00
de23395fa7 vim-patch:7.4.888
Problem:    The OptionSet autocommands are not triggered from setwinvar().
Solution:   Do not use switch_win() when not needed. (Hirohito Higashi)

ba117c23df
2016-02-15 11:05:17 +01:00
2d5cba630c vim-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)

089af18d1f
2016-02-15 19:02:52 +09:00
7609a96a35 Merge pull request #4260 from watiko/vim-7.4.887
vim-patch:7.4.887
2016-02-15 04:17:25 -05:00
ec6fcf3b1c vim-patch:7.4.887
Problem:    Using uninitialized memory for regexp with back reference.
            (Dominique Pelle)
Solution:   Initialize end_lnum.

c2b717ebd6

---

see: "[bug] use of uninitialized memory in regexp_nfa.c with invalid back reference"
     https://groups.google.com/d/msg/vim_dev/JWmrT5-NnPQ/U_TgaRW8AwAJ
2016-02-15 18:10:30 +09:00
baee9fe286 Merge pull request #4220 from watiko/vim-7.4.792
vim-patch:7.4.792
2016-02-15 03:55:23 -05:00
ceccaf7a5e test: Remove files of old test 36. 2016-02-15 09:30:17 +01:00
109d53b7b9 test: Migrate legacy test 36.
The test was split into several blocks reusing the same input file.  As it is
complicated to send text in different encodings and with control characters
from the test suite to nvim and back the results are written to a temp file
and loaded into the test from there.
2016-02-15 09:25:49 +01:00
0581ec396c test: Remove old files for legacy test 11. 2016-02-15 09:09:23 +01:00
291715286b test: Migrate legacy test 11.
Some parts of the test depend on gzip(1).  They are skipped if gzip is not
available.

Some `:write` and `:edit` commands produce messages and "hit enter" prompts
that had to be treated with an extra `feed('<C-L>')`.  In the original test
file this was not neccessary because it was `:source!`ed.
2016-02-15 09:09:16 +01:00
e0727ced13 vim-patch:7.4.881
Problem:    Test 49 fails.
Solution:   Add line number to check of call stack.

0a777ab989
2016-02-15 16:27:05 +09:00
5b1a536d50 vim-patch:7.4.879
Problem:    Can't see line numbers in nested function calls.
Solution:   Add line number to the file name. (Alberto Fanjul)

1d6328ca00
2016-02-15 16:08:16 +09:00
1e995ea2fd Merge #4140 'vim-patch:7.4.771'. 2016-02-15 01:48:30 -05:00
69234f4a76 test: search_mbyte_spec: minor cleanup
mbyte.vim, small.vim are not relevant to migrated legacy tests.
2016-02-15 01:47:43 -05:00
e0ca30553b Merge pull request #4166 from lucc/legacy/command_count
tests: Migrate legacy test command_count.
2016-02-15 01:10:15 -05:00
02612a3fc9 Merge pull request #4254 from Shougo/remote
Improve remote plugin scripts
2016-02-15 00:27:43 -05:00
e3bf1385e6 Merge pull request #4252 from justinmk/filetype
defaults: Enable filetypes, syntax
2016-02-14 17:20:55 -05:00
cc2dce45d0 startup: Avoid VimL global. Introduce TriState enum.
- `syntax_on` is documented. Rather than introduce a new undocumented
  VimL global `g:syntax_off`, use a module-local flag.
- Rename "maybe" functions to follow style guidelines (use standard
  module prefix)
2016-02-14 16:23:04 -05:00
6c9c08c370 startup: respect earlier :filetype and :syntax.
If user invokes :filetype or :syntax before startup defaults are
applied, don't clobber their choices.
2016-02-14 15:38:11 -05:00
da6299445a ex_docmd: rename force_enable_filetype().
It is no longer forcing anything.
2016-02-14 15:20:32 -05:00
9c2c24ec48 syntax: don't override user settings 2016-02-14 15:20:32 -05:00
cae0904160 syntax: avoid extra global macro 2016-02-14 15:20:31 -05:00
50e129f5a7 defaults: Enable syntax and filetype plugins. 2016-02-14 15:20:31 -05:00
75f6817a51 Merge pull request #4216 from bfredl/rebuild
build system: avoid more unneccesary recompiles
2016-02-14 12:07:55 +01:00
8d7ab23b49 build system: avoid more unneccesary recompiles 2016-02-14 11:41:28 +01:00
d19af41db4 Merge pull request #4248 from watiko/vim-nas
version.c: Mark patches NA
2016-02-13 18:47:23 -05:00
41794f6b58 Improve remote plugin scripts 2016-02-14 08:24:49 +09:00
0b21956edb version.c: Mark patches NA
NA patch list:

684: vim_tempfile() was refactored
     e5c421cfd7

725: str_to_reg() was refactored
     659c94d483

752: (Unicode 8.0) automatically generates these tables
     66312acf14

767: (clientserver)
     fafeee6b9e

804: (xxd)
     43fe32900c

812: ml_add_stack() was refactored by e53dda90bd
     fbd302ff38

821: (coverity)
     handled by 33cecbbf16
                aca6dc5001
                bb674e0fcd
     bd8539aac3

827: (src/Makefile)
     8cba8ba3e0

838: (crypt, ifdef)
     8060687905

839: (cast) vim_strnsave()'s 2nd argument type is already size_t
     6ed535dbc0

860: (empty commit) missing parts are in other runtime comitts
     a122b5e98a

865: (uninitializing) handled by 7f99d210fd
     ed84b76021

866: (netbeans)
     93c88e0f6a

873: (netbeans, unused) related to 866
     b8603882b1

897: (clientserver)
     4e86150ec5

---

NA runtime patch:

vim-patch:e2db6c9
2016-02-14 08:05:39 +09:00
364d764889 Merge #2674 2016-02-13 15:22:12 -05:00
7567afbbe5 test: completion_spec: minor edits 2016-02-13 15:21:28 -05:00
6c99667b6e vim-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...

e68c25c677
2016-02-12 19:41:10 +09:00
b6fdc3eb47 vim-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.

b341dda575

---

":set all&" does not reset 'encoding' in neovim.
2016-02-12 16:09:51 +09:00
f03ab69a35 Merge pull request #4237 from Jun-T/shada-symlink
resolve symlink in shada_spec test
2016-02-11 18:23:15 -05:00
d12460123e vim-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)

c79a5452ac
2016-02-11 22:55:00 +01:00
a21becf7ee vim-patch:7.4.877
Problem:    ":find" sometimes fails. (Excanoe)
Solution:   Compare current characters instead of previous ones.

4d0c7bc74a
2016-02-11 22:31:19 +01:00
edbc97225d test: shada_spec: resolve symlink
If the build directory path has symlinks in it, 'make functionaltest'
fails at shada_spec.lua:177 because readme_fname has symlink but
nvim resolves the symlink when writing it into the shada file.
2016-02-12 00:03:39 +09:00
8ba32e219f Merge pull request #4235 from watiko/vim-7.4.828
vim-patch:7.4.828
2016-02-11 09:32:53 -05:00
d115b58cdc vim-patch:7.4.828
Problem:    Crash when using "syn keyword x c". (Dominique Pelle)
Solution:   Initialize the keyword tabble. (Raymond Ko, PR 397)

670acbc70f

---

see: "fix crash due to hash table not being initialized"
     https://github.com/vim/vim/pull/397

To reproduce:

```sh
nvim -u NONE -c ow -c 'sy keyword x c'
```
2016-02-11 19:06:54 +09:00
adb73b6025 Merge pull request #4204 from watiko/vim-7.4.915
vim-patch:7.4.{749,915}
2016-02-11 03:45:08 -05:00
63d750f310 Merge pull request #4186 from watiko/vim-7.4.929
vim-patch:7.4.{734,743,929}
2016-02-11 03:35:09 -05:00
eab6ed778d vim-patch:7.4.977
Problem:    'linebreak' does not work properly when using "space" in
            'listchars'.
Solution:   (Hirohito Higashi, Christian Brabandt)

9bc01ebb95
2016-02-11 17:08:36 +09:00
8eb0d43c12 vim-patch:7.4.883
Problem:    Block-mode replace works characterwise instead of blockwise after
            column 147. (Issue #422)
Solution:   Set Visual mode. (Christian Brabandt)

10ad1d90da
2016-02-11 16:45:08 +09:00
66571f64a4 vim-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)

89c17c02ca
2016-02-11 16:37:11 +09:00
bfab33ef79 vim-patch:7.4.931 (NA)
Problem:    Test 94 fails on some systems.
Solution:   Set 'encoding' to utf-8.

cfcd1ddd10

---

Neovim cannot change encoding after start-up.
2016-02-11 15:14:36 +09:00
51c3e0aa80 vim-patch:7.4.929
Problem:    "gv" after paste selects one character less if 'selection' is
            "exclusive".
Solution:   Increment the end position. (Christian Brabandt)

d29c6fea94
2016-02-11 15:13:30 +09:00
663e1ed158 vim-patch:7.4.743
Problem:    "p" in Visual mode causes an unexpected line split.
Solution:   Advance the cursor first. (Yukihiro Nakadaira)

c004bc2726
2016-02-11 15:13:30 +09:00
4a0e10fb2c vim-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)

d009e86826
2016-02-11 15:13:30 +09:00
b137ebdd17 tests: Migrate legacy test match_conceal 2016-02-11 15:08:31 +09:00
133ef7e465 vim-patch:7.4.792
Problem:    Can only conceal text by defining syntax items.
Solution:   Use matchadd() to define concealing. (Christian Brabandt)

6561d52ecb
2016-02-11 15:08:31 +09:00
162d4bb3c6 vim-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)

4a4b821085
2016-02-10 22:51:16 +01:00
14c543231c vim-patch:7.4.847
Problem:    "vi)d" may leave a character behind.
Solution:   Skip over multi-byte character. (Christian Brabandt)

8667d66ca9
2016-02-10 22:35:24 +01:00
84281bf675 Merge pull request #4205 from watiko/vim-7.4.737
vim-patch:7.4.737
2016-02-10 20:51:14 +01:00
953e140a18 Merge pull request #4224 from fmoralesc/docs-term
doc: remove references to 'term' and other tty related options.
2016-02-10 11:01:23 -05:00
11f43360d1 doc: remove references to 'term' and other tty related options.
Re: https://github.com/neovim/neovim/issues/4218
2016-02-10 16:52:48 +01:00
9b9695ab8e Merge pull request #4221 from Jun-T/install-mo
install *.mo files correctly
2016-02-10 10:37:24 -05:00
c74dc9dd6c Merge pull request #4225 from bfredl/helptags
build: if helptags generation fails, echo the message
2016-02-10 10:27:08 -05:00
81f54f909e set VIMPACKAGE to "nvim" 2016-02-10 21:34:10 +09:00
222a1655f5 cmake: if helptags generation fails, echo the message 2016-02-10 13:23:23 +01:00
c2384597ef Merge pull request #4217 from fmoralesc/vim-7.4.735
vim-patch: 7.4.735 is NA
2016-02-10 11:17:47 +01:00
c5c53ed8b4 vim-patch:7.4.735 (NA)
Problem:    Wrong argument for sizeof().
Solution:   Use a pointer argument. (Chris Hall)

e2e4b98622

This was already handled in nvim.
2016-02-10 10:25:18 +01:00
0690c3358d install *.mo files correctly 2016-02-10 16:45:37 +09:00
6d57b48a53 vim-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)

6e8d3b0d41

---

Fix a lint error for the closing parenthesis.
NOLINT does not help to do this.
2016-02-10 16:19:33 +09:00
e7615ddc22 CMake: Add #include in _FORTIFY_SOURCE check. #4214
Some toolchains apparently set _FORTIFY_SOURCE=2 in internal header
files. Include <string.h> (which in turn should include such internal
header files) before checking the value of _FORTIFY_SOURCE to catch
that.

Fixes #4183.
2016-02-10 00:17:55 +01:00
313c24a31b vim-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)

a09a2c5857
2016-02-10 00:00:29 +01:00
37288e522a vim-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)

cf619daa8e
2016-02-09 23:51:28 +01:00
b86553c7ad file_search: Change return type of ff_wc_equal to bool.
This makes sense since the function returns only TRUE or FALSE.
2016-02-09 23:12:50 +01:00
c9898e0ec3 vim-patch:7.4.843
Problem:    Still possible to go beyond the end of a string.
Solution:   Check for NUL also in second string. (Dominique Pelle)

d43f0951bc
2016-02-09 23:08:24 +01:00
ab8a771dbd file_search: Declare loop variables inside the loop. 2016-02-09 23:08:24 +01:00
e8dd996703 vim-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)

f6470c288c
2016-02-09 23:08:24 +01:00
586daa6b4c buffer_defs: Remove spaces in member declarations. 2016-02-09 22:47:25 +01:00
cdd2bdabee Fix linter errors. 2016-02-09 22:47:25 +01:00
35d50ab5b9 vim-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'.

54f018cd59
2016-02-09 22:47:25 +01:00
dcdb50b64b Merge pull request #4212 from jbradaric/vim-7.4.834
vim-patch:7.4.834
2016-02-09 22:26:30 +01:00
f19e4dd1df vim-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)

7e47d1ac6a
2016-02-09 20:21:26 +01:00
3be74ac634 Merge pull request #4103 from cacplate/pr-3695
charset.c: change return type to bool
2016-02-09 18:18:53 +01:00
35b6a020b9 charset.c: change return type to bool
Co-authored-by: Wayne Rowcliffe
2016-02-09 11:13:04 -05:00
8b5cc1230a Syntax: skip over ]
The ported patch for 7.4.825 removed code that is needed to walk over "]" by
accident.

0: 52692d3cd3
1: 1560d07045

Fixes #4207.
2016-02-09 15:28:52 +01:00
25a70469f4 Merge pull request #4187 from watiko/vim-7.4.742
vim-patch:7.4.742
2016-02-09 02:19:17 -05:00
6fbb9ceb5e Merge pull request #4184 from watiko/vim-7.4.732
vim-patch:7.4.732
2016-02-09 02:14:38 -05:00
7c2b2ea9c9 Merge pull request #4178 from watiko/vim-7.4.708
vim-patch:7.4.{708,717}
2016-02-09 02:10:57 -05:00
b9701c2a2b Merge #4152 'vim-patch:7.4.{798,800,805,810,811,814,815,816,817,820,825}'. 2016-02-09 01:58:54 -05:00
17ae27190d Merge #4136 vim-patch:7.4.{755,758,760} 2016-02-09 01:41:04 -05:00
18be6e0b30 vim-patch:979243b
Update help files.

https://github.com/vim/vim/commit/979243b
2016-02-09 01:36:29 -05:00
0429b7714f vim-patch:7.4.760
Problem:    Spelling mistakes are not displayed after ":syn spell".
Solution:   Force a redraw after ":syn spell" command. (Christian Brabandt)

5081d20247
2016-02-09 01:36:29 -05:00
b0cfb6905a vim-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)

fa67fbe6b8
2016-02-09 01:36:29 -05:00
a9a25fda42 vim-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)

641e48c224
2016-02-09 01:36:29 -05:00
31aa060bca vim-patch:7.4.801
Problem:    Test for ":diffoff" doesn't catch all potential problems.
Solution:   Add a :diffthis and a :diffoff command. (Olaf Dabrunz)

278236000f
2016-02-09 01:17:02 -05:00
39e5d9287e Merge #4139 'vim-patch:7.4.{768,769}'. 2016-02-09 01:04:54 -05:00
81ccfc576f vim-patch:7.4.769
Problem:    Behavior of :diffoff is not tested.
Solution:   Add a bit of testing. (Olaf Dabrunz)

2693ca21ce
2016-02-09 01:03:33 -05:00
32e33aabdf vim-patch:7.4.768
Problem:    :diffoff only works properly once.
Solution:   Also make :diffoff work when used a second time. (Olaf Dabrunz)

4392996461
2016-02-09 01:03:33 -05:00
69e5427be1 vim-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)

174674743d
2016-02-09 14:44:53 +09:00
c90c47072f vim-patch:7.4.749
Problem:    For some options two consecutive commas are OK. (Nikolay Pavlov)
Solution:   Add the P_ONECOMMA flag.

0e7c4b99c6
2016-02-09 14:44:53 +09:00
cb5ee26540 Merge pull request #4094 from justinmk/_GNU_SOURCE
cmake: Linux: define _GNU_SOURCE.
2016-02-09 00:34:14 -05:00
d402841b54 version bump 2016-02-09 00:21:54 -05:00
bf6c5bc225 Fix lint errors 2016-02-09 09:39:52 +09:00
ba8ec7e963 vim-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)

a594d77ffc
2016-02-07 17:54:37 +09:00
8b2b9b83b7 vim-patch:7.4.732
Problem:    The cursor line is not always updated for the "O" command.
Solution:   Reset the VALID_CROW flag. (Christian Brabandt)

d0d0fe09cf
2016-02-07 08:22:34 +09:00
70ab198221 vim-patch:7.4.717
Problem:    ":let list += list" can change a locked list.
Solution:   Check for the lock earlier. (Olaf Dabrunz)

1cd5e613b0
2016-02-06 05:54:15 +09:00
fef753fa6d vim-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)

77354e78a8
2016-02-06 05:54:15 +09:00
ec663d8069 tests: Remove old test files for command_count. 2016-02-04 19:33:16 +01:00
ad83cd82e1 tests: Simplify migrated legacy test. 2016-02-04 19:25:07 +01:00
c1b0c45bee tests: Fix migrated legacy test.
The test involves argument and buffer numbers.  Therefore it was necessary to
use a custom testing session to ensure that the initial buffer corresponds to
an argument.
2016-02-04 19:23:47 +01:00
153fe65c01 tests: Migrate legacy test command_count. 2016-02-04 19:20:59 +01:00
52692d3cd3 vim-patch:7.4.825
Problem:    Invalid memory access for ":syn keyword x a[".
Solution:   Do not skip over the NUL. (Dominique Pelle)

1560d07045
2016-02-02 20:33:43 +01:00
8d5cfe4ffc vim-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)

8fee878fe2
2016-02-02 20:29:41 +01:00
5feff1c415 vim-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)

2288afed42
2016-02-02 20:20:23 +01:00
3c0a082894 vim-patch:7.4.816
Problem:    Invalid memory access when doing ":fun X(".
Solution:   Check for missing ')'. (Dominique Pelle)

dd8a5286e1
2016-02-02 20:09:45 +01:00
105f98fbf8 vim-patch:7.4.815
Problem:    Invalid memory access when doing ":call g:".
Solution:   Check for an empty name. (Dominique Pelle)

73627d0bd4
2016-02-02 20:06:35 +01:00
ce2ff1ac01 vim-patch:7.4.814
Problem:    Illegal memory access with "sy match a fold".
Solution:   Check for empty string. (Dominique Pelle)

382197865c
2016-02-02 19:58:30 +01:00
f20818de31 vim-patch:7.4.811
Problem:    Invalid memory access when using "exe 'sc'".
Solution:   Avoid going over the end of the string. (Dominique Pelle)

204b93f958
2016-02-02 19:54:04 +01:00
2b2f9ccf8c vim-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)

9dd33af4ba
2016-02-02 18:54:09 +01:00
cfce719c66 vim-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.

29bc9db36e
2016-02-02 18:41:44 +01:00
cdc7250cd8 vim-patch:7.4.800
Problem:    Using freed memory when triggering CmdUndefined autocommands.
Solution:   Set pointer to NULL. (Dominique Pelle)

829aef1eb4
2016-02-02 18:34:31 +01:00
ffd143be82 vim-patch:7.4.798
Problem:    Repeating a change in Visual mode does not work as expected.
            (Urtica Dioica)
Solution:   Make redo in Visual mode work better. (Christian Brabandt)

31b259bf95
2016-02-02 18:29:23 +01:00
ZyX
18d1ba3422 runtime/msgpack: Fix msgpack#string that expects old string() behavior 2016-02-02 00:54:00 +03:00
ZyX
610b48c5b0 functests: Add string() function tests 2016-02-02 00:54:00 +03:00
ZyX
b2ea083eeb eval: Return different values when dividing by zero
Fixes #3263
2016-02-02 00:54:00 +03:00
ZyX
2873a17c55 eval: Use str2float() to represent inf and nan values
Closes #3248
2016-02-02 00:46:10 +03:00
815ba27f75 legacy2luatest: Use before_each instead of setup.
This will avoid confusion if additional `it()` blocks are added.
(`setup()` only runs once per `describe()` block, whereas `before_each()`
runs before each `it()`).
2016-02-01 09:09:08 +01:00
63a12e1e2d Remove unused variables from the test. 2016-02-01 08:54:13 +01:00
696adeb0f6 Use before_each instead of setup in the test. 2016-02-01 08:52:38 +01:00
cabf079ae4 search: Fix linter errors. 2016-02-01 08:48:57 +01:00
02cf813eff Add test files for patch 7.4.771.
vim-patch:efcabd6892ad89a4585fb77aa94c3b1802b784ab
2016-02-01 08:48:36 +01:00
7d2d4b1918 vim-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)

5f1e68b7bc
2016-01-30 21:31:11 +01:00
fd14f64e26 tests: add always complete test 2016-01-29 22:03:30 +08:00
edb5fb88aa edit.c: fix incorrect redo buffer 2016-01-29 22:03:23 +08:00
b55726b350 edit.c: fix flicker in popup menu 2016-01-29 22:03:11 +08:00
b5f6f43095 cmake: Linux: define _GNU_SOURCE.
Closes #4042
2016-01-24 21:18:44 -05:00
15cd8916df cs_print_tags_priv: Clean up function.
* Style changes
* Variable removal
* Comment update
2016-01-21 17:24:12 +01:00
dd0b358af5 cs_print_tags_priv: Clear first output line to screen end
Using `:cscope find s <cword>` with the cursor on a very short word like
`key` does not output the first line on the screen correctly: Output is
`Cscope tag: keyrd>` instead of
`Cscope tag: key`.

To fix this, clear the screen line after the first line was printed.
2016-01-21 16:52:50 +01:00
a649299e76 coverity/133892: Resource leak
Variable tbuf going out of scope leaks the storage it points to.

We don't have to use the copy tbuf of a match. Because matches are always in
ctags style, we can operate on them directly.
2016-01-21 16:37:58 +01:00
f2558890f5 coverity/133858: Out-of-bounds access
Allocating insufficient memory for the terminating NUL of the string.

False positive, we allocating more memory than we need.
2016-01-21 16:37:58 +01:00
7a8e41e8ee coverity/13753: Dereference null return value
Dereferencing a pointer that might be null(ptag) when calling strlen().

False positive. A match always contains a tab, so ptag is never null.
Because matches are always in ctags style, we can rewrite the code to
not use strtok().
2016-01-21 16:37:58 +01:00
294 changed files with 18970 additions and 9314 deletions

View File

@ -5,6 +5,9 @@ build_deps() {
if [[ "${BUILD_MINGW}" == ON ]]; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_MINGW}"
fi
if [[ "${FUNCTIONALTEST}" == "functionaltest-lua" ]]; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
fi
rm -rf "${DEPS_BUILD_DIR}"

View File

@ -53,7 +53,7 @@ run_unittests() {
}
run_functionaltests() {
if ! ${MAKE_CMD} -C "${BUILD_DIR}" functionaltest; then
if ! ${MAKE_CMD} -C "${BUILD_DIR}" ${FUNCTIONALTEST}; then
asan_check "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
exit 1

12
.editorconfig Normal file
View File

@ -0,0 +1,12 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
charset = utf_8
[Makefile]
indent_style = tab
tab_width = 4

View File

@ -53,6 +53,8 @@ env:
# if the tests were successful, but don't have this information
# available in before_cache (which is run before after_success).
- SUCCESS_MARKER="$BUILD_DIR/.tests_successful"
# default target name for functional tests
- FUNCTIONALTEST=functionaltest
matrix:
include:
@ -60,6 +62,9 @@ matrix:
env: CI_TARGET=lint
- os: linux
compiler: gcc-5
- os: linux
compiler: gcc-5
env: FUNCTIONALTEST=functionaltest-lua
- os: linux
# Travis creates a cache per compiler.
# Set a different value here to store 32-bit

View File

@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 2.8.7)
project(NEOVIM)
project(nvim)
if(POLICY CMP0059)
cmake_policy(SET CMP0059 OLD) # Needed until cmake 2.8.12. #4389
endif()
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
@ -55,7 +59,7 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
# version string, else it is combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 1)
set(NVIM_VERSION_PATCH 2)
set(NVIM_VERSION_PATCH 4)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
@ -153,7 +157,11 @@ if(${INIT_FLAGS_NAME})
set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}")
endif()
# Include <string.h> because some toolchains define _FORTIFY_SOURCE=2 in
# internal header files, which should in turn be #included by <string.h>.
check_c_source_compiles("
#include <string.h>
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1
#error \"_FORTIFY_SOURCE > 1\"
#endif
@ -202,6 +210,12 @@ if(MSVC)
else()
add_definitions(-Wall -Wextra -pedantic -Wno-unused-parameter
-Wstrict-prototypes -std=gnu99)
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
# 3.4.1 used there.
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
add_definitions(-Wno-c11-extensions)
endif()
endif()
if(MINGW)
@ -254,6 +268,10 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
# For O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags on older systems
# (pre POSIX.1-2008: glibc 2.11 and earlier). #4042
add_definitions(-D_GNU_SOURCE)
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "SunOS")
@ -349,7 +367,7 @@ endforeach()
# Find Lua interpreter
include(LuaHelpers)
set(LUA_DEPENDENCIES lpeg MessagePack bit)
set(LUA_DEPENDENCIES lpeg mpack bit)
if(NOT LUA_PRG)
foreach(CURRENT_LUA_PRG luajit lua)
# If LUA_PRG is set find_program() will not search
@ -376,6 +394,7 @@ message(STATUS "Using the Lua interpreter ${LUA_PRG}.")
# Setup busted.
find_program(BUSTED_PRG busted)
find_program(BUSTED_LUA_PRG busted-lua)
if(NOT BUSTED_OUTPUT_TYPE)
set(BUSTED_OUTPUT_TYPE "utfTerminal")
endif()
@ -487,6 +506,20 @@ if(BUSTED_PRG)
DEPENDS ${BENCHMARK_PREREQS})
endif()
if(BUSTED_LUA_PRG)
add_custom_target(functionaltest-lua
COMMAND ${CMAKE_COMMAND}
-DBUSTED_PRG=${BUSTED_LUA_PRG}
-DNVIM_PRG=$<TARGET_FILE:nvim>
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS})
endif()
if(LUACHECK_PRG)
add_custom_target(testlint
COMMAND ${CMAKE_COMMAND}

16
ISSUE_TEMPLATE.md Normal file
View File

@ -0,0 +1,16 @@
- Neovim version:
- [ ] Vim behaves differently? Vim version:
- Operating system/version:
- Terminal name/version:
- `$TERM`:
### Actual behaviour
### Expected behaviour
### Steps to reproduce using `nvim -u NORC`
```
nvim -u NORC
```

View File

@ -45,6 +45,11 @@ ifneq (,$(USE_BUNDLED_DEPS))
BUNDLED_CMAKE_FLAG := -DUSE_BUNDLED=$(USE_BUNDLED_DEPS)
endif
ifneq (,$(findstring functionaltest-lua,$(MAKECMDGOALS)))
BUNDLED_LUA_CMAKE_FLAG := -DUSE_BUNDLED_LUA=ON
$(shell [ -x .deps/usr/bin/lua ] || rm build/.ran-*)
endif
# For use where we want to make sure only a single job is run. This does issue
# a warning, but we need to keep SCRIPTS argument.
SINGLE_MAKE = export MAKEFLAGS= ; $(MAKE)
@ -74,7 +79,7 @@ build/.ran-third-party-cmake:
ifeq ($(call filter-true,$(USE_BUNDLED_DEPS)),)
mkdir -p .deps
cd .deps && \
cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) \
cmake -G '$(BUILD_TYPE)' $(BUNDLED_CMAKE_FLAG) $(BUNDLED_LUA_CMAKE_FLAG) \
$(DEPS_CMAKE_FLAGS) ../third-party
endif
mkdir -p build
@ -86,6 +91,9 @@ oldtest: | nvim
functionaltest: | nvim
+$(BUILD_CMD) -C build functionaltest
functionaltest-lua: | nvim
+$(BUILD_CMD) -C build functionaltest-lua
testlint: | nvim
$(BUILD_CMD) -C build testlint

View File

@ -191,6 +191,7 @@ _ERROR_CATEGORIES = [
'readability/nul',
'readability/todo',
'readability/utf8',
'readability/increment',
'runtime/arrays',
'runtime/int',
'runtime/invalid_increment',
@ -2291,6 +2292,11 @@ def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
# there's too little whitespace, we get concerned. It's hard to tell,
# though, so we punt on this one for now. TODO.
match = Search(r'(?:[^ (*/![])+(?<!\+\+|--)\*', line)
if match:
error(filename, linenum, 'whitespace/operators', 2,
'Missing space before asterisk in %s' % match.group(0))
# You should always have whitespace around binary operators.
#
# Check <= and >= first to avoid false positives with < and >, then
@ -2552,7 +2558,7 @@ def CheckBraces(filename, clean_lines, linenum, error):
# If should always have a brace
for blockstart in ('if', 'while', 'for'):
if Match(r'\s*{0}[^{{]*$'.format(blockstart), line):
if Match(r'\s*{0}(?!\w)[^{{]*$'.format(blockstart), line):
pos = line.find(blockstart)
pos = line.find('(', pos)
if pos > 0:
@ -3194,6 +3200,23 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
error(filename, linenum, 'readability/bool', 4,
'Use %s instead of %s.' % (token.lower(), token))
# Detect preincrement/predecrement
match = Match(r'^\s*(?:\+\+|--)', line)
if match:
error(filename, linenum, 'readability/increment', 5,
'Do not use preincrement in statements, '
'use postincrement instead')
# Detect preincrement/predecrement in for(;; preincrement)
match = Search(r';\s*(\+\+|--)', line)
if match:
end_pos, end_depth = FindEndOfExpressionInLine(line, match.start(1), 1,
'(', ')')
expr = line[match.start(1):end_pos]
if end_depth == 0 and ';' not in expr and ' = ' not in expr:
error(filename, linenum, 'readability/increment', 4,
'Do not use preincrement in statements, including '
'for(;; action)')
def ProcessLine(filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
@ -3484,6 +3507,7 @@ def main():
if __name__ == '__main__':
main()
# vim: ts=4 sts=4 sw=4
# Ignore "too complex" warnings when using pymode.
# pylama:ignore=C901

View File

@ -2,7 +2,11 @@ get_filename_component(LINT_DIR ${LINT_DIR} ABSOLUTE)
get_filename_component(LINT_PREFIX ${LINT_DIR} PATH)
set(LINT_SUPPRESS_FILE "${LINT_PREFIX}/errors.json")
file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h)
if(DEFINED ENV{LINT_FILE})
file(GLOB_RECURSE LINT_FILES "$ENV{LINT_FILE}")
else()
file(GLOB_RECURSE LINT_FILES ${LINT_DIR}/*.c ${LINT_DIR}/*.h)
endif()
set(LINT_ARGS)

View File

@ -12,6 +12,9 @@
#define ARCH_32
#endif
#define PROJECT_NAME "@PROJECT_NAME@"
#define LOCALE_INSTALL_DIR "@CMAKE_INSTALL_FULL_LOCALEDIR@"
#cmakedefine HAVE__NSGETENVIRON
#cmakedefine HAVE_FD_CLOEXEC
#cmakedefine HAVE_FSEEKO

View File

@ -35,7 +35,7 @@ add_custom_command(OUTPUT ${GENERATED_HELP_TAGS}
COMMAND "${PROJECT_BINARY_DIR}/bin/nvim"
-u NONE
-i NONE
-es
-e
--headless
-c "helptags ++t ."
-c quit

View File

@ -11,6 +11,8 @@ catch /E145:/
" Ignore the error in restricted mode
endtry
" Load man page {page} from {section}
" call man#get_page([{section}, ]{page})
function man#get_page(...) abort
let invoked_from_man = (&filetype ==# 'man')
@ -20,21 +22,14 @@ function man#get_page(...) abort
elseif a:0 > 2
echoerr 'too many arguments'
return
elseif a:0 == 2
let [page, sect] = [a:2, 0 + a:1]
elseif type(1) == type(a:1)
let [page, sect] = ['<cword>', a:1]
else
let [page, sect] = [a:1, '']
endif
if page == '<cword>'
let page = expand('<cword>')
endif
let sect = get(a:000, 0)
let page = get(a:000, 1, sect)
let [page, sect] = s:parse_page_and_section(sect, page)
if 0 + sect > 0 && s:find_page(sect, page) == 0
if !empty(sect) && s:find_page(sect, page) == 0
let sect = ''
endif
@ -54,9 +49,9 @@ function man#get_page(...) abort
let thiswin = winnr()
wincmd b
if winnr() > 1
exe "norm! " . thiswin . "\<C-W>w"
exec thiswin . 'wincmd w'
while 1
if &filetype == 'man'
if &filetype ==# 'man'
break
endif
wincmd w
@ -80,11 +75,11 @@ function man#get_page(...) abort
endif
silent exec 'r!/usr/bin/man '.s:cmd(sect, page).' | col -b'
" Remove blank lines from top and bottom.
while getline(1) =~ '^\s*$'
silent keepjumps norm! gg"_dd
while getline(1) =~# '^\s*$'
silent keepjumps 1delete _
endwhile
while getline('$') =~ '^\s*$'
silent keepjumps norm! G"_dd
while getline('$') =~# '^\s*$'
silent keepjumps $delete _
endwhile
setlocal nomodified
setlocal filetype=man
@ -118,15 +113,11 @@ endfunction
" Expects a string like 'access' or 'access(2)'.
function s:parse_page_and_section(sect, str) abort
try
let save_isk = &iskeyword
setlocal iskeyword-=(,)
let page = substitute(a:str, '(*\(\k\+\).*', '\1', '')
let sect = substitute(a:str, '\(\k\+\)(\([^()]*\)).*', '\2', '')
if sect == page || -1 == match(sect, '^[0-9 ]\+$')
let [page, sect] = matchlist(a:str, '\v\C([-.[:alnum:]_]+)%(\(([-.[:alnum:]_]+)\))?')[1:2]
if empty(sect)
let sect = a:sect
endif
catch
let &l:iskeyword = save_isk
echoerr 'man.vim: failed to parse: "'.a:str.'"'
endtry
@ -134,7 +125,7 @@ function s:parse_page_and_section(sect, str) abort
endfunction
function s:cmd(sect, page) abort
if 0 + a:sect > 0
if !empty(a:sect)
return s:man_sect_arg.' '.a:sect.' '.a:page
endif
return a:page
@ -142,10 +133,5 @@ endfunction
function s:find_page(sect, page) abort
let where = system('/usr/bin/man '.s:man_find_arg.' '.s:cmd(a:sect, a:page))
if where !~ "^/"
if matchstr(where, " [^ ]*$") !~ "^ /"
return 0
endif
endif
return 1
return (where =~# '^ */')
endfunction

View File

@ -356,6 +356,8 @@ let s:MSGPACK_STANDARD_TYPES = {
\type(''): 'binary',
\type([]): 'array',
\type({}): 'map',
\type(v:true): 'boolean',
\type(v:null): 'nil',
\}
""
@ -379,7 +381,7 @@ endfunction
""
" Dump boolean value.
function s:msgpack_dump_boolean(v) abort
return a:v._VAL ? 'TRUE' : 'FALSE'
return (a:v is v:true || (a:v isnot v:false && a:v._VAL)) ? 'TRUE' : 'FALSE'
endfunction
""
@ -395,7 +397,8 @@ endfunction
""
" Dump floating-point value.
function s:msgpack_dump_float(v) abort
return string(type(a:v) == type({}) ? a:v._VAL : a:v)
return substitute(string(type(a:v) == type({}) ? a:v._VAL : a:v),
\'\V\^\(-\)\?str2float(''\(inf\|nan\)'')\$', '\1\2', '')
endfunction
""

View File

@ -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: 2015 Apr 02
" Last Change: 2015 Jul 13
"
" OPTIONS:
"
@ -318,7 +318,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
@ -646,7 +646,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
@ -981,7 +981,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
@ -1379,8 +1379,8 @@ 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
let doc_str = phpcomplete#GetDocBlock(split(classstructure.content, '\n'), docblock_target_pattern)
if doc_str != ''
break
endif
@ -1659,7 +1659,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
" function declaration line
if line =~? 'function\(\s\+'.function_name_pattern.'\)\?\s*('
let function_lines = join(reverse(lines), " ")
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)')
@ -1700,10 +1700,12 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
" 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(lines)
let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col])
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
@ -1711,7 +1713,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
let chars_read += 1
" we got a candidate
if char == ';'
let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name')
" 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
@ -1719,7 +1725,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
endif
endwhile
let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin)
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
@ -1739,13 +1745,14 @@ 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
" 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(lines)
let [pos, char] = s:getNextCharWithPos(filelines, [a:start_line - i - 1, start_col])
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
@ -1753,7 +1760,11 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
let chars_read += 1
" we got a candidate
if char == ';'
let synIDName = synIDattr(synID(pos[0] + 1, pos[1] + 1, 0), 'name')
" 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
@ -1761,7 +1772,7 @@ function! phpcomplete#GetClassName(start_line, context, current_namespace, impor
endif
endwhile
let prev_context = phpcomplete#GetCurrentInstruction(last_pos[0] + 1, last_pos[1], b:phpbegin)
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
@ -1864,6 +1875,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 = '\'
@ -1876,7 +1890,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\|interface\|trait\)\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
@ -2048,9 +2062,18 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
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 extends_class = ''
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 implemented_interfaces = []
endif
call searchpair('{', '', '}', 'W')
let class_closing_bracket_line = line('.')
@ -2108,8 +2131,11 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
\ })
let all_extends = used_traits
if extends_class != ''
call add(all_extends, extends_class)
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
@ -2119,11 +2145,16 @@ function! phpcomplete#GetClassContentsStructure(file_path, file_lines, class_nam
endif
let classlocation = phpcomplete#GetClassLocation(class, namespace)
if classlocation == "VIMPHP_BUILTINOBJECT"
let result += [phpcomplete#GenerateBuiltinClassStub(g:php_builtin_classes[tolower(class)])]
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)
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
@ -2144,43 +2175,53 @@ function! phpcomplete#GetClassContents(classlocation, class_name) " {{{
endfunction
" }}}
function! phpcomplete#GenerateBuiltinClassStub(class_info) " {{{
let re = 'class '.a:class_info['name']." {"
for [name, initializer] in items(a:class_info.constants)
let re .= "\n\tconst ".name." = ".initializer.";"
endfor
for [name, info] in items(a:class_info.properties)
let re .= "\n\t// @var $".name." ".info.type
let re .= "\n\tpublic $".name.";"
endfor
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
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
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
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 { 'class': a:class_info['name'],
return { a:type : a:class_info['name'],
\ 'content': re,
\ 'namespace': '',
\ 'imports': {},
@ -2204,8 +2245,11 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{
" start backward serch 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
@ -2227,6 +2271,7 @@ function! phpcomplete#GetDocBlock(sccontent, search) " {{{
endif
let l -= 1
endwhile
" no docblock comment start found
if comment_start == -1
return ''
@ -2388,7 +2433,15 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{
break
endif
let block_end_pos = searchpairpos('{', '', '}\|\%$', 'W', 'synIDattr(synID(line("."), col("."), 0), "name") =~? "string\\|comment"')
silent! exec block_start_pos[0].','.block_end_pos[0].'d'
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
@ -2407,8 +2460,8 @@ function! phpcomplete#GetCurrentNameSpace(file_lines) " {{{
while i < file_length
let line = file_lines[i]
if line =~? '^\s*namespace\s*'.namespace_name_pattern
let current_namespace = matchstr(line, '\c^\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
@ -2571,7 +2624,7 @@ 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

View File

@ -47,6 +47,11 @@ elseif exists('$DISPLAY') && executable('xclip')
let s:paste['+'] = 'xclip -o -selection clipboard'
let s:copy['*'] = 'xclip -quiet -i -selection primary'
let s:paste['*'] = 'xclip -o -selection primary'
elseif executable('lemonade')
let s:copy['+'] = 'lemonade copy'
let s:paste['+'] = 'lemonade paste'
let s:copy['*'] = 'lemonade copy'
let s:paste['*'] = 'lemonade paste'
else
echom 'clipboard: No clipboard tool available. See :help nvim-clipboard'
finish

View File

@ -24,12 +24,10 @@ if s:prog == ''
finish
endif
let s:plugin_path = expand('<sfile>:p:h').'/script_host.py'
" The Python provider plugin will run in a separate instance of the Python
" host.
call remote#host#RegisterClone('legacy-python-provider', 'python')
call remote#host#RegisterPlugin('legacy-python-provider', s:plugin_path, [])
call remote#host#RegisterPlugin('legacy-python-provider', 'script_host.py', [])
function! provider#python#Call(method, args)
if s:err != ''

View File

@ -24,12 +24,10 @@ if s:prog == ''
finish
endif
let s:plugin_path = expand('<sfile>:p:h').'/script_host.py'
" The Python3 provider plugin will run in a separate instance of the Python3
" host.
call remote#host#RegisterClone('legacy-python3-provider', 'python3')
call remote#host#RegisterPlugin('legacy-python3-provider', s:plugin_path, [])
call remote#host#RegisterPlugin('legacy-python3-provider', 'script_host.py', [])
function! provider#python3#Call(method, args)
if s:err != ''

View File

@ -5,6 +5,32 @@ endif
let s:loaded_pythonx_provider = 1
function! provider#pythonx#Require(host) abort
let ver = (a:host.orig_name ==# 'python') ? 2 : 3
" Python host arguments
let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()']
" Collect registered Python plugins into args
let python_plugins = remote#host#PluginsForHost(a:host.name)
for plugin in python_plugins
call add(args, plugin.path)
endfor
try
let channel_id = rpcstart((ver == '2' ?
\ provider#python#Prog() : provider#python3#Prog()), args)
if rpcrequest(channel_id, 'poll') == 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name,
\ '$NVIM_PYTHON_LOG_FILE')
endfunction
function! provider#pythonx#Detect(major_ver) abort
let host_var = (a:major_ver == 2) ?
\ 'g:python_host_prog' : 'g:python3_host_prog'

View File

@ -0,0 +1,34 @@
" The Ruby provider helper
if exists('s:loaded_ruby_provider')
finish
endif
let s:loaded_ruby_provider = 1
function! provider#ruby#Require(host) abort
" Collect registered Ruby plugins into args
let args = []
let ruby_plugins = remote#host#PluginsForHost(a:host.name)
for plugin in ruby_plugins
call add(args, plugin.path)
endfor
try
let channel_id = rpcstart(provider#ruby#Prog(), args)
if rpcrequest(channel_id, 'poll') == 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name,
\ '$NVIM_RUBY_LOG_FILE')
endfunction
function! provider#ruby#Prog() abort
return 'neovim-ruby-host'
endfunction

View File

@ -1,247 +0,0 @@
"""Legacy python/python3-vim emulation."""
import imp
import io
import logging
import os
import sys
import neovim
__all__ = ('ScriptHost',)
logger = logging.getLogger(__name__)
debug, info, warn = (logger.debug, logger.info, logger.warn,)
IS_PYTHON3 = sys.version_info >= (3, 0)
if IS_PYTHON3:
basestring = str
if sys.version_info >= (3, 4):
from importlib.machinery import PathFinder
@neovim.plugin
class ScriptHost(object):
"""Provides an environment for running python plugins created for Vim."""
def __init__(self, nvim):
"""Initialize the legacy python-vim environment."""
self.setup(nvim)
# context where all code will run
self.module = imp.new_module('__main__')
nvim.script_context = self.module
# it seems some plugins assume 'sys' is already imported, so do it now
exec('import sys', self.module.__dict__)
self.legacy_vim = nvim.with_hook(LegacyEvalHook())
sys.modules['vim'] = self.legacy_vim
def setup(self, nvim):
"""Setup import hooks and global streams.
This will add import hooks for importing modules from runtime
directories and patch the sys module so 'print' calls will be
forwarded to Nvim.
"""
self.nvim = nvim
info('install import hook/path')
self.hook = path_hook(nvim)
sys.path_hooks.append(self.hook)
nvim.VIM_SPECIAL_PATH = '_vim_path_'
sys.path.append(nvim.VIM_SPECIAL_PATH)
info('redirect sys.stdout and sys.stderr')
self.saved_stdout = sys.stdout
self.saved_stderr = sys.stderr
sys.stdout = RedirectStream(lambda data: nvim.out_write(data))
sys.stderr = RedirectStream(lambda data: nvim.err_write(data))
def teardown(self):
"""Restore state modified from the `setup` call."""
for plugin in self.installed_plugins:
if hasattr(plugin, 'on_teardown'):
plugin.teardown()
nvim = self.nvim
info('uninstall import hook/path')
sys.path.remove(nvim.VIM_SPECIAL_PATH)
sys.path_hooks.remove(self.hook)
info('restore sys.stdout and sys.stderr')
sys.stdout = self.saved_stdout
sys.stderr = self.saved_stderr
@neovim.rpc_export('python_execute', sync=True)
def python_execute(self, script, range_start, range_stop):
"""Handle the `python` ex command."""
self._set_current_range(range_start, range_stop)
exec(script, self.module.__dict__)
@neovim.rpc_export('python_execute_file', sync=True)
def python_execute_file(self, file_path, range_start, range_stop):
"""Handle the `pyfile` ex command."""
self._set_current_range(range_start, range_stop)
with open(file_path) as f:
script = compile(f.read(), file_path, 'exec')
exec(script, self.module.__dict__)
@neovim.rpc_export('python_do_range', sync=True)
def python_do_range(self, start, stop, code):
"""Handle the `pydo` ex command."""
self._set_current_range(start, stop)
nvim = self.nvim
start -= 1
stop -= 1
fname = '_vim_pydo'
# define the function
function_def = 'def %s(line, linenr):\n %s' % (fname, code,)
exec(function_def, self.module.__dict__)
# get the function
function = self.module.__dict__[fname]
while start <= stop:
# Process batches of 5000 to avoid the overhead of making multiple
# API calls for every line. Assuming an average line length of 100
# bytes, approximately 488 kilobytes will be transferred per batch,
# which can be done very quickly in a single API call.
sstart = start
sstop = min(start + 5000, stop)
lines = nvim.current.buffer.get_line_slice(sstart, sstop, True,
True)
exception = None
newlines = []
linenr = sstart + 1
for i, line in enumerate(lines):
result = function(line, linenr)
if result is None:
# Update earlier lines, and skip to the next
if newlines:
end = sstart + len(newlines) - 1
nvim.current.buffer.set_line_slice(sstart, end,
True, True,
newlines)
sstart += len(newlines) + 1
newlines = []
pass
elif isinstance(result, basestring):
newlines.append(result)
else:
exception = TypeError('pydo should return a string ' +
'or None, found %s instead'
% result.__class__.__name__)
break
linenr += 1
start = sstop + 1
if newlines:
end = sstart + len(newlines) - 1
nvim.current.buffer.set_line_slice(sstart, end, True, True,
newlines)
if exception:
raise exception
# delete the function
del self.module.__dict__[fname]
@neovim.rpc_export('python_eval', sync=True)
def python_eval(self, expr):
"""Handle the `pyeval` vim function."""
return eval(expr, self.module.__dict__)
def _set_current_range(self, start, stop):
current = self.legacy_vim.current
current.range = current.buffer.range(start, stop)
class RedirectStream(io.IOBase):
def __init__(self, redirect_handler):
self.redirect_handler = redirect_handler
def write(self, data):
self.redirect_handler(data)
def writelines(self, seq):
self.redirect_handler('\n'.join(seq))
class LegacyEvalHook(neovim.SessionHook):
"""Injects legacy `vim.eval` behavior to a Nvim instance."""
def __init__(self):
super(LegacyEvalHook, self).__init__(from_nvim=self._string_eval)
def _string_eval(self, obj, session, method, kind):
if method == 'vim_eval':
if IS_PYTHON3:
if isinstance(obj, (int, float)):
return str(obj)
elif isinstance(obj, (int, long, float)):
return str(obj)
return obj
# This was copied/adapted from nvim-python help
def path_hook(nvim):
def _get_paths():
return discover_runtime_directories(nvim)
def _find_module(fullname, oldtail, path):
idx = oldtail.find('.')
if idx > 0:
name = oldtail[:idx]
tail = oldtail[idx+1:]
fmr = imp.find_module(name, path)
module = imp.find_module(fullname[:-len(oldtail)] + name, *fmr)
return _find_module(fullname, tail, module.__path__)
else:
return imp.find_module(fullname, path)
class VimModuleLoader(object):
def __init__(self, module):
self.module = module
def load_module(self, fullname, path=None):
# Check sys.modules, required for reload (see PEP302).
if fullname in sys.modules:
return sys.modules[fullname]
return imp.load_module(fullname, *self.module)
class VimPathFinder(object):
@staticmethod
def find_module(fullname, path=None):
"Method for Python 2.7 and 3.3."
try:
return VimModuleLoader(
_find_module(fullname, fullname, path or _get_paths()))
except ImportError:
return None
@staticmethod
def find_spec(fullname, path=None, target=None):
"Method for Python 3.4+."
return PathFinder.find_spec(fullname, path or _get_paths(), target)
def hook(path):
if path == nvim.VIM_SPECIAL_PATH:
return VimPathFinder
else:
raise ImportError
return hook
def discover_runtime_directories(nvim):
rv = []
for path in nvim.list_runtime_paths():
if not os.path.exists(path):
continue
path1 = os.path.join(path, 'pythonx')
if IS_PYTHON3:
path2 = os.path.join(path, 'python3')
else:
path2 = os.path.join(path, 'python2')
if os.path.exists(path1):
rv.append(path1)
if os.path.exists(path2):
rv.append(path2)
return rv

View File

@ -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)

View File

@ -1,7 +1,7 @@
function! remote#define#CommandOnHost(host, method, sync, name, opts)
let prefix = ''
if has_key(a:opts, 'range')
if has_key(a:opts, 'range')
if a:opts.range == '' || a:opts.range == '%'
" -range or -range=%, pass the line range in a list
let prefix = '<line1>,<line2>'
@ -30,7 +30,7 @@ function! remote#define#CommandOnHost(host, method, sync, name, opts)
exe s:GetCommandPrefix(a:name, a:opts)
\ .' call remote#define#CommandBootstrap("'.a:host.'"'
\ . ', "'.a:method.'"'
\ . ', "'.a:sync.'"'
\ . ', '.string(a:sync)
\ . ', "'.a:name.'"'
\ . ', '.string(a:opts).''
\ . ', "'.join(forward_args, '').'"'
@ -94,7 +94,7 @@ function! remote#define#AutocmdOnHost(host, method, sync, name, opts)
let bootstrap_def = s:GetAutocmdPrefix(a:name, a:opts)
\ .' call remote#define#AutocmdBootstrap("'.a:host.'"'
\ . ', "'.a:method.'"'
\ . ', "'.a:sync.'"'
\ . ', '.string(a:sync)
\ . ', "'.a:name.'"'
\ . ', '.string(a:opts).''
\ . ', "'.escape(forward, '"').'"'
@ -133,7 +133,7 @@ function! remote#define#FunctionOnHost(host, method, sync, name, opts)
exe 'autocmd! '.group.' FuncUndefined '.a:name
\ .' call remote#define#FunctionBootstrap("'.a:host.'"'
\ . ', "'.a:method.'"'
\ . ', "'.a:sync.'"'
\ . ', '.string(a:sync)
\ . ', "'.a:name.'"'
\ . ', '.string(a:opts)
\ . ', "'.group.'"'
@ -157,6 +157,9 @@ endfunction
function! remote#define#FunctionOnChannel(channel, method, sync, name, opts)
let rpcargs = [a:channel, '"'.a:method.'"', 'a:000']
if has_key(a:opts, 'range')
call add(rpcargs, '[a:firstline, a:lastline]')
endif
call s:AddEval(rpcargs, a:opts)
let function_def = s:GetFunctionPrefix(a:name, a:opts)
@ -187,7 +190,7 @@ let s:next_gid = 1
function! s:GetNextAutocmdGroup()
let gid = s:next_gid
let s:next_gid += 1
let group_name = 'RPC_DEFINE_AUTOCMD_GROUP_'.gid
" Ensure the group is defined
exe 'augroup '.group_name.' | augroup END'
@ -218,7 +221,11 @@ endfunction
function! s:GetFunctionPrefix(name, opts)
return "function! ".a:name."(...)\n"
let res = "function! ".a:name."(...)"
if has_key(a:opts, 'range')
let res = res." range"
endif
return res."\n"
endfunction

View File

@ -2,10 +2,11 @@ let s:hosts = {}
let s:plugin_patterns = {}
let s:remote_plugins_manifest = fnamemodify(expand($MYVIMRC, 1), ':h')
\.'/.'.fnamemodify($MYVIMRC, ':t').'-rplugin~'
let s:plugins_for_host = {}
" Register a host by associating it with a factory(funcref)
function! remote#host#Register(name, pattern, factory)
function! remote#host#Register(name, pattern, factory) abort
let s:hosts[a:name] = {'factory': a:factory, 'channel': 0, 'initialized': 0}
let s:plugin_patterns[a:name] = a:pattern
if type(a:factory) == type(1) && a:factory
@ -19,7 +20,7 @@ endfunction
" as `source`, but it will run as a different process. This can be used by
" plugins that should run isolated from other plugins created for the same host
" type
function! remote#host#RegisterClone(name, orig_name)
function! remote#host#RegisterClone(name, orig_name) abort
if !has_key(s:hosts, a:orig_name)
throw 'No host named "'.a:orig_name.'" is registered'
endif
@ -34,7 +35,10 @@ endfunction
" Get a host channel, bootstrapping it if necessary
function! remote#host#Require(name)
function! remote#host#Require(name) abort
if empty(s:plugins_for_host)
call remote#host#LoadRemotePlugins()
endif
if !has_key(s:hosts, a:name)
throw 'No host named "'.a:name.'" is registered'
endif
@ -51,7 +55,7 @@ function! remote#host#Require(name)
endfunction
function! remote#host#IsRunning(name)
function! remote#host#IsRunning(name) abort
if !has_key(s:hosts, a:name)
throw 'No host named "'.a:name.'" is registered'
endif
@ -72,7 +76,7 @@ endfunction
"
" The third item in a declaration is a boolean: non zero means the command,
" autocommand or function will be executed synchronously with rpcrequest.
function! remote#host#RegisterPlugin(host, path, specs)
function! remote#host#RegisterPlugin(host, path, specs) abort
let plugins = remote#host#PluginsForHost(a:host)
for plugin in plugins
@ -116,14 +120,21 @@ function! remote#host#RegisterPlugin(host, path, specs)
endfunction
function! remote#host#LoadRemotePlugins()
function! remote#host#LoadRemotePlugins() abort
if filereadable(s:remote_plugins_manifest)
exe 'source '.s:remote_plugins_manifest
endif
endfunction
function! s:RegistrationCommands(host)
function! remote#host#LoadRemotePluginsEvent(event, pattern) abort
autocmd! nvim-rplugin
call remote#host#LoadRemotePlugins()
execute 'silent doautocmd <nomodeline>' a:event a:pattern
endfunction
function! s:RegistrationCommands(host) abort
" Register a temporary host clone for discovering specs
let host_id = a:host.'-registration-clone'
call remote#host#RegisterClone(host_id, a:host)
@ -138,7 +149,9 @@ function! s:RegistrationCommands(host)
endfor
let channel = remote#host#Require(host_id)
let lines = []
let registered = []
for path in paths
unlet! specs
let specs = rpcrequest(channel, 'specs', path)
if type(specs) != type([])
" host didn't return a spec list, indicates a failure while loading a
@ -151,9 +164,10 @@ function! s:RegistrationCommands(host)
call add(lines, " \\ ".string(spec).",")
endfor
call add(lines, " \\ ])")
call add(registered, path)
endfor
echomsg printf("remote/host: %s host registered plugins %s",
\ a:host, string(map(copy(paths), "fnamemodify(v:val, ':t')")))
\ a:host, string(map(registered, "fnamemodify(v:val, ':t')")))
" Delete the temporary host clone
call rpcstop(s:hosts[host_id].channel)
@ -163,7 +177,7 @@ function! s:RegistrationCommands(host)
endfunction
function! s:UpdateRemotePlugins()
function! remote#host#UpdateRemotePlugins() abort
let commands = []
let hosts = keys(s:hosts)
for host in hosts
@ -180,14 +194,12 @@ function! s:UpdateRemotePlugins()
endif
endfor
call writefile(commands, s:remote_plugins_manifest)
echomsg printf('remote/host: generated the manifest file in "%s"',
\ s:remote_plugins_manifest)
endfunction
command! UpdateRemotePlugins call s:UpdateRemotePlugins()
let s:plugins_for_host = {}
function! remote#host#PluginsForHost(host)
function! remote#host#PluginsForHost(host) abort
if !has_key(s:plugins_for_host, a:host)
let s:plugins_for_host[a:host] = []
end
@ -195,40 +207,25 @@ function! remote#host#PluginsForHost(host)
endfunction
" Registration of standard hosts
" Python/Python3 {{{
function! s:RequirePythonHost(host)
let ver = (a:host.orig_name ==# 'python') ? 2 : 3
" Python host arguments
let args = ['-c', 'import sys; sys.path.remove(""); import neovim; neovim.start_host()']
" Collect registered Python plugins into args
let python_plugins = remote#host#PluginsForHost(a:host.name)
for plugin in python_plugins
call add(args, plugin.path)
endfor
try
let channel_id = rpcstart((ver == '2' ?
\ provider#python#Prog() : provider#python3#Prog()), args)
if rpcrequest(channel_id, 'poll') == 'ok'
return channel_id
endif
catch
echomsg v:throwpoint
echomsg v:exception
endtry
throw 'Failed to load '. a:host.orig_name . ' host. '.
function! remote#host#LoadErrorForHost(host, log) abort
return 'Failed to load '. a:host . ' host. '.
\ 'You can try to see what happened '.
\ 'by starting Neovim with the environment variable '.
\ '$NVIM_PYTHON_LOG_FILE set to a file and opening '.
\ 'the generated log file. Also, the host stderr will be available '.
\ a:log . ' set to a file and opening the generated '.
\ 'log file. Also, the host stderr will be available '.
\ 'in Neovim log, so it may contain useful information. '.
\ 'See also ~/.nvimlog.'
endfunction
call remote#host#Register('python', '*.py', function('s:RequirePythonHost'))
call remote#host#Register('python3', '*.py', function('s:RequirePythonHost'))
" }}}
" Registration of standard hosts
" Python/Python3
call remote#host#Register('python', '*',
\ function('provider#pythonx#Require'))
call remote#host#Register('python3', '*',
\ function('provider#pythonx#Require'))
" Ruby
call remote#host#Register('ruby', '*.rb',
\ function('provider#ruby#Require'))

View File

@ -1,6 +1,4 @@
" Vim script to download a missing spell file
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2012 Jan 08
if !exists('g:spellfile_URL')
" Prefer using http:// when netrw should be able to use it, since
@ -43,22 +41,23 @@ function! spellfile#LoadFile(lang)
if len(dirlist) == 0
let dir_to_create = spellfile#WritableSpellDir()
if &verbose || dir_to_create != ''
echomsg 'spellfile#LoadFile(): There is no writable spell directory.'
echomsg 'spellfile#LoadFile(): No (writable) spell directory found.'
endif
if dir_to_create != ''
if confirm("Shall I create " . dir_to_create, "&Yes\n&No", 2) == 1
" After creating the directory it should show up in the list.
call mkdir(dir_to_create, "p")
let [dirlist, dirchoices] = spellfile#GetDirChoices()
endif
call mkdir(dir_to_create, "p")
" Now it should show up in the list.
let [dirlist, dirchoices] = spellfile#GetDirChoices()
endif
if len(dirlist) == 0
echomsg 'Failed to create: '.dir_to_create
return
else
echomsg 'Created '.dir_to_create
endif
endif
let msg = 'Cannot find spell file for "' . a:lang . '" in ' . &enc
let msg .= "\nDo you want me to try downloading it?"
let msg = 'No spell file for "' . a:lang . '" in ' . &enc
let msg .= "\nDownload it?"
if confirm(msg, "&Yes\n&No", 2) == 1
let enc = &encoding
if enc == 'iso-8859-15'
@ -78,78 +77,77 @@ function! spellfile#LoadFile(lang)
" Careful: Nread() may have opened a new window for the error message,
" we need to go back to our own buffer and window.
if newbufnr != winbufnr(0)
let winnr = bufwinnr(newbufnr)
if winnr == -1
" Our buffer has vanished!? Open a new window.
echomsg "download buffer disappeared, opening a new one"
new
setlocal bin fenc=
else
exe winnr . "wincmd w"
endif
let winnr = bufwinnr(newbufnr)
if winnr == -1
" Our buffer has vanished!? Open a new window.
echomsg "download buffer disappeared, opening a new one"
new
setlocal bin fenc=
else
exe winnr . "wincmd w"
endif
endif
if newbufnr == winbufnr(0)
" We are back the old buffer, remove any (half-finished) download.
g/^/d
" We are back the old buffer, remove any (half-finished) download.
g/^/d_
else
let newbufnr = winbufnr(0)
let newbufnr = winbufnr(0)
endif
let fname = a:lang . '.ascii.spl'
echo 'Could not find it, trying ' . fname . '...'
call spellfile#Nread(fname)
if getline(2) !~ 'VIMspell'
echo 'Sorry, downloading failed'
exe newbufnr . "bwipe!"
return
echo 'Download failed'
exe newbufnr . "bwipe!"
return
endif
endif
" Delete the empty first line and mark the file unmodified.
1d
1d_
set nomod
let msg = "In which directory do you want to write the file:"
for i in range(len(dirlist))
let msg .= "\n" . (i + 1) . '. ' . dirlist[i]
endfor
let dirchoice = confirm(msg, dirchoices) - 2
if len(dirlist) == 1
let dirchoice = 0
else
let msg = "In which directory do you want to write the file:"
for i in range(len(dirlist))
let msg .= "\n" . (i + 1) . '. ' . dirlist[i]
endfor
let dirchoice = confirm(msg, dirchoices) - 2
endif
if dirchoice >= 0
if exists('*fnameescape')
let dirname = fnameescape(dirlist[dirchoice])
let dirname = fnameescape(dirlist[dirchoice])
else
let dirname = escape(dirlist[dirchoice], ' ')
let dirname = escape(dirlist[dirchoice], ' ')
endif
setlocal fenc=
exe "write " . dirname . '/' . fname
" Also download the .sug file, if the user wants to.
let msg = "Do you want me to try getting the .sug file?\n"
let msg .= "This will improve making suggestions for spelling mistakes,\n"
let msg .= "but it uses quite a bit of memory."
if confirm(msg, "&No\n&Yes") == 2
g/^/d
let fname = substitute(fname, '\.spl$', '.sug', '')
echo 'Downloading ' . fname . '...'
call spellfile#Nread(fname)
if getline(2) =~ 'VIMsug'
1d
exe "write " . dirname . '/' . fname
set nomod
else
echo 'Sorry, downloading failed'
" Go back to our own buffer/window, Nread() may have taken us to
" another window.
if newbufnr != winbufnr(0)
let winnr = bufwinnr(newbufnr)
if winnr != -1
exe winnr . "wincmd w"
endif
endif
if newbufnr == winbufnr(0)
set nomod
endif
endif
" Also download the .sug file.
g/^/d_
let fname = substitute(fname, '\.spl$', '.sug', '')
echo 'Downloading ' . fname . '...'
call spellfile#Nread(fname)
if getline(2) =~ 'VIMsug'
1d_
exe "write " . dirname . '/' . fname
set nomod
else
echo 'Download failed'
" Go back to our own buffer/window, Nread() may have taken us to
" another window.
if newbufnr != winbufnr(0)
let winnr = bufwinnr(newbufnr)
if winnr != -1
exe winnr . "wincmd w"
endif
endif
if newbufnr == winbufnr(0)
set nomod
endif
endif
endif

View File

@ -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

99
runtime/doc/api.txt Normal file
View File

@ -0,0 +1,99 @@
*api.txt* For Nvim. {Nvim}
NVIM REFERENCE MANUAL by Thiago de Arruda
The C API of Nvim *nvim-api*
1. Introduction |nvim-api-intro|
2. API Types |nvim-api-types|
3. API metadata |nvim-api-metadata|
4. Buffer highlighting |nvim-api-highlights|
==============================================================================
1. Introduction *nvim-api-intro*
Nvim defines a C API as the primary way for external code to interact with
the NVim core. In the present version of Nvim the API is primarily used by
external processes to interact with Nvim using the msgpack-rpc protocol, see
|msgpack-rpc|. The API will also be used from vimscript to access new Nvim core
features, but this is not implemented yet. Later on, Nvim might be embeddable
in C applications as libnvim, and the application will then control the
embedded instance by calling the C API directly.
==============================================================================
2. API Types *nvim-api-types*
Nvim's C API uses custom types for all functions. Some are just typedefs
around C99 standard types, and some are Nvim defined data structures.
Boolean -> bool
Integer (signed 64-bit integer) -> int64_t
Float (IEEE 754 double precision) -> double
String -> {char* data, size_t size} struct
Additionally, the following data structures are defined:
Array
Dictionary
Object
The following handle types are defined as integer typedefs, but are
discriminated as separate types in an Object:
Buffer -> enum value kObjectTypeBuffer
Window -> enum value kObjectTypeWindow
Tabpage -> enum value kObjectTypeTabpage
==============================================================================
3. API metadata *nvim-api-metadata*
Nvim exposes metadata about the API as a Dictionary with the following keys:
functions calling signature of the API functions
types The custom handle types defined by Nvim
error_types The possible kinds of errors an API function can exit with.
This metadata is mostly useful for external programs accessing the api over
msgpack-api, see |msgpack-rpc-api|.
==============================================================================
4. Buffer highlighting *nvim-api-highlights*
Nvim allows plugins to add position-based highlights to buffers. This is
similar to |matchaddpos()| but with some key differences. The added highlights
are associated with a buffer and adapts to line insertions and deletions,
similar to signs. It is also possible to manage a set of highlights as a group
and delete or replace all at once.
The intended use case are linter or semantic highlighter plugins that monitor
a buffer for changes, and in the background compute highlights to the buffer.
Another use case are plugins that show output in an append-only buffer, and
want to add highlights to the outputs. Highlight data cannot be preserved
on writing and loading a buffer to file, nor in undo/redo cycles.
Highlights are registered using the |buffer_add_highlight| function, see the
generated API documentation for details. If an external highlighter plugin is
adding a large number of highlights in a batch, performance can be improved by
calling |buffer_add_highlight| as an asynchronous notification, after first
(synchronously) reqesting a source id. Here is an example using wrapper
functions in the python client:
>
src = vim.new_highlight_source()
buf = vim.current.buffer
for i in range(5):
buf.add_highlight("String",i,0,-1,src_id=src)
# some time later
buf.clear_highlight(src)
<
If the highlights don't need to be deleted or updated, just pass -1 as
src_id (this is the default in python). |buffer_clear_highlight| can be used
to clear highligts from a specific source, in a specific line range or the
entire buffer by passing in the line range 0, -1 (the later is the default
in python as used above).
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@ -1,4 +1,4 @@
*autocmd.txt* For Vim version 7.4. Last change: 2015 Mar 21
*autocmd.txt* For Vim version 7.4. Last change: 2015 Aug 18
VIM REFERENCE MANUAL by Bram Moolenaar
@ -308,6 +308,8 @@ Name triggered by ~
|InsertCharPre| when a character was typed in Insert mode, before
inserting it
|TextYankPost| when some text is yanked or deleted
|TextChanged| after a change was made to the text in Normal mode
|TextChangedI| after a change was made to the text in Insert mode
@ -722,6 +724,18 @@ InsertCharPre When a character is typed in Insert mode,
It is not allowed to change the text |textlock|.
The event is not triggered when 'paste' is
set.
*TextYankPost*
TextYankPost Just after a |yank| or |deleting| command, but not
if the black hole register |quote_| is used nor
for |setreg()|. Pattern must be * because its
meaning may change in the future.
Sets these |v:event| keys:
operator
regcontents
regname
regtype
Recursion is ignored.
It is not allowed to change the text |textlock|.
*InsertEnter*
InsertEnter Just before starting Insert mode. Also for
Replace mode and Virtual Replace mode. The
@ -756,13 +770,15 @@ OptionSet After setting an option. The pattern is
it's global or local scoped and |<amatch>|
indicates what option has been set.
Note: It's a bad idea, to reset an option
during this autocommand, since this will
probably break plugins. You can always use
|:noa| to prevent triggering this autocommand.
Could be used, to check for existence of the
'backupdir' and 'undodir' options and create
directories, if they don't exist yet.
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|,
@ -1086,7 +1102,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: >

View File

@ -1,4 +1,4 @@
*change.txt* For Vim version 7.4. Last change: 2015 Feb 10
*change.txt* For Vim version 7.4. Last change: 2015 Sep 06
VIM REFERENCE MANUAL by Bram Moolenaar
@ -366,14 +366,45 @@ Adding and subtracting ~
CTRL-A Add [count] to the number or alphabetic character at
or after the cursor.
*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.
The CTRL-A and CTRL-X commands can work for:
- signed and unsigned decimal numbers
- unsigned binary, octal and hexadecimal numbers
- alphabetic characters
*v_CTRL-X*
{Visual}CTRL-X Subtract [count] from the number or alphabetic
character in the highlighted text. {not in Vi}
*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 work for (signed) decimal numbers, unsigned
binary/octal/hexadecimal numbers and alphabetic characters.
This depends on the 'nrformats' option:
- When 'nrformats' includes "bin", Vim assumes numbers starting with '0b' or
@ -591,9 +622,9 @@ For MS-Windows: $TMP, $TEMP, $USERPROFILE, current-dir.
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
@ -1071,7 +1102,7 @@ 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 "-

View File

@ -1,4 +1,4 @@
*cmdline.txt* For Vim version 7.4. Last change: 2014 Sep 06
*cmdline.txt* For Vim version 7.4. Last change: 2015 Sep 25
VIM REFERENCE MANUAL by Bram Moolenaar
@ -565,6 +565,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
@ -714,13 +715,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.
@ -755,6 +756,7 @@ it, no matter how many backslashes.
# alternate.file
\# #
\\# \#
Also see |`=|.
*:<cword>* *:<cWORD>* *:<cfile>* *<cfile>*
*:<sfile>* *<sfile>* *:<afile>* *<afile>*
@ -776,13 +778,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
@ -844,7 +846,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'))
@ -897,9 +899,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.
@ -910,6 +911,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
@ -936,6 +938,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*

View File

@ -1,4 +1,4 @@
*diff.txt* For Vim version 7.4. Last change: 2015 Feb 03
*diff.txt* For Vim version 7.4. Last change: 2015 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@ -124,8 +124,9 @@ file for a moment and come back to the same file and be in diff mode again.
if the current window does not have 'diff' set then no options
in it are changed.
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

View File

@ -1,4 +1,4 @@
*editing.txt* For Vim version 7.4. Last change: 2015 Apr 18
*editing.txt* For Vim version 7.4. Last change: 2015 Aug 25
VIM REFERENCE MANUAL by Bram Moolenaar
@ -378,25 +378,38 @@ Finds files:
/usr/include/sys/types.h
/usr/inc_old/types.h
*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`
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',
@ -1203,12 +1216,18 @@ use has("browsefilter"): >
==============================================================================
7. The current directory *current-directory*
You may use the |:cd| and |:lcd| commands to change to another directory, so
you will not have to type that directory name in front of the file names. It
also makes a difference for executing external commands, e.g. ":!ls".
You can use |:cd|, |:tcd| and |:lcd| to change to another directory, so you
will not have to type that directory name in front of the file names. It also
makes a difference for executing external commands, e.g. ":!ls" or ":te ls".
Changing directory fails when the current buffer is modified, the '.' flag is
present in 'cpoptions' and "!" is not used in the command.
There are three current-directory "scopes": global, tab and window. The
window-local working directory takes precedence over the tab-local
working directory, which in turn takes precedence over the global
working directory. If a local working directory (tab or window) does not
exist, the next-higher scope in the hierarchy applies.
Commands for changing the working directory can be suffixed with a bang "!"
(e.g. |:cd!|) which is ignored, for compatibility with Vim.
*:cd* *E747* *E472*
:cd[!] On non-Unix systems: Print the current directory
@ -1233,29 +1252,50 @@ present in 'cpoptions' and "!" is not used in the command.
*:chd* *:chdir*
:chd[ir][!] [path] Same as |:cd|.
*:tc* *:tcd* *E5000* *E5001* *E5002*
:tc[d][!] {path} Like |:cd|, but set the current directory for the
current tab and window. The current directory for
other tabs and windows is not changed.
*:tcd-*
:tcd[!] - Change to the previous current directory (before the
previous ":tcd {path}" command).
*:tch* *:tchdir*
:tch[dir][!] Same as |:tcd|.
*: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.
windows or any tabs is not changed.
*:lch* *:lchdir*
:lch[dir][!] Same as |:lcd|.
*:lcd-*
:lcd[!] - Change to the previous current directory (before the
previous ":tcd {path}" command).
*:pw* *:pwd* *E187*
:pw[d] Print the current directory name.
Also see |getcwd()|.
So long as no |:lcd| command has been used, all windows share the same current
directory. Using a command to jump to another window doesn't change anything
for the current directory.
When a |:lcd| command has been used for a window, the specified directory
becomes the current directory for that window. Windows where the |:lcd|
command has not been used stick to the global current directory. When jumping
to another window the current directory will become the last specified local
current directory. If none was specified, the global current directory is
used.
When a |:cd| command is used, the current window will lose his local current
directory and will use the global current directory from now on.
So long as no |:tcd| or |:lcd| command has been used, all windows share the
same "current directory". Using a command to jump to another window doesn't
change anything for the current directory.
When |:lcd| has been used for a window, the specified directory becomes the
current directory for that window. Windows where the |:lcd| command has not
been used stick to the global or tab-local directory. When jumping to another
window the current directory will become the last specified local current
directory. If none was specified, the global or tab-local directory is used.
When changing tabs the same behaviour applies. If the current tab has no
local working directory the global working directory is used. When a |:cd|
command is used, the current window and tab will lose their local current
directories and will use the global current directory from now on. When
a |:tcd| command is used, only the current window will lose its local working
directory.
After using |:cd| the full path name will be used for reading and writing
files. On some networked file systems this may cause problems. The result of
@ -1292,7 +1332,7 @@ There are a few things to remember when editing binary files:
and when the file is written the <NL> will be replaced with <CR> <NL>.
- <Nul> characters are shown on the screen as ^@. You can enter them with
"CTRL-V CTRL-@" or "CTRL-V 000".
- 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
@ -1304,9 +1344,7 @@ There are a few things to remember when editing binary files:
9. Encryption *encryption*
*:X* *E817* *E818* *E819* *E820*
Support for editing encrypted files has been removed, but may be added back in
the future. See the following discussions for more information:
Support for editing encrypted files has been removed.
https://github.com/neovim/neovim/issues/694
https://github.com/neovim/neovim/issues/701

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30
*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16
VIM REFERENCE MANUAL by Bram Moolenaar
@ -916,6 +916,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*
@ -1003,7 +1008,7 @@ function. Example: >
string *string* *expr-string* *E114*
string *string* *String* *expr-string* *E114*
------
"string" string constant *expr-quote*
@ -1386,6 +1391,22 @@ v:errors Errors found by assert functions, such as |assert_true()|.
< 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 of event data for the current |autocommand|. The
available keys differ per event type and are specified at the
documentation for each |event|. The possible keys are:
operator The operation performed. Unlike
|v:operator|, it is set also for an Ex
mode command. For instance, |:yank| is
translated to "|y|".
regcontents Text stored in the register as a
|readfile()|-style list of lines.
regname Requested register (e.g "x" for "xyy)
or the empty string for an unnamed
operation.
regtype Type of register as returned by
|getregtype()|.
*v:exception* *exception-variable*
v:exception The value of the exception most recently caught and not
finished. See also |v:throwpoint| and |throw-variables|.
@ -1397,6 +1418,13 @@ v:exception The value of the exception most recently caught and not
:endtry
< Output: "caught oops".
*v:false* *false-variable*
v:false Special value used to put "false" in JSON and msgpack. See
|json_encode()|. This value is converted to "false" when used
as a String (e.g. in |expr5| with string concatenation
operator) and to zero when used as a Number (e.g. in |expr5|
or |expr7| when used with numeric operators).
*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
@ -1475,7 +1503,9 @@ v:hlsearch Variable that indicates whether search highlighting is on.
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:
@ -1534,6 +1564,13 @@ v:msgpack_types Dictionary containing msgpack types used by |msgpackparse()|
(not editable) empty lists. To check whether some list is one
of msgpack types, use |is| operator.
*v:null* *null-variable*
v:null Special value used to put "null" in JSON and NIL in msgpack.
See |json_encode()|. This value is converted to "null" when
used as a String (e.g. in |expr5| with string concatenation
operator) and to zero when used as a Number (e.g. in |expr5|
or |expr7| when used with numeric operators).
*v:oldfiles* *oldfiles-variable*
v:oldfiles List of file names that is loaded from the |shada| file on
startup. These are the files that Vim remembers marks for.
@ -1699,6 +1736,13 @@ 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 Special value used to put "true" in JSON and msgpack. See
|json_encode()|. This value is converted to "true" when used
as a String (e.g. in |expr5| with string concatenation
operator) and to one when used as a Number (e.g. in |expr5| or
|expr7| when used with numeric operators).
*v:val* *val-variable*
v:val Value of the current item of a |List| or |Dictionary|. Only
valid while evaluating the expression used with |map()| and
@ -1719,7 +1763,8 @@ v:version Version number of Vim: Major version number times 100 plus
v:warningmsg Last given warning message. It's allowed to set this variable.
*v:windowid* *windowid-variable* {Nvim}
v:windowid Is a no-op at the moment; the value is always set to 0.
v:windowid Application-specific window ID ("window handle" in MS-Windows)
which may be set by any attached UI. Defaults to zero.
Note: for windows inside Vim use |winnr()|.
==============================================================================
@ -1756,7 +1801,7 @@ 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}
bufnr( {expr} [, {create}]) 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}
@ -1785,9 +1830,11 @@ 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}) Number delete file {fname}
dictwatcheradd({dict}, {pattern}, {callback}) Start watching a dictionary
dictwatcherdel({dict}, {pattern}, {callback}) Stop watching a dictionary
delete( {fname} [, {flags}]) Number delete the file or directory {fname}
dictwatcheradd( {dict}, {pattern}, {callback})
Start watching a dictionary
dictwatcherdel( {dict}, {pattern}, {callback})
Stop watching a dictionary
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}
@ -1807,7 +1854,7 @@ 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
{string} is 0
finddir( {name}[, {path}[, {count}]])
String find directory {name} in {path}
findfile( {name}[, {path}[, {count}]])
@ -1833,12 +1880,13 @@ 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
getcharsearch() Dict last character search
getcmdline() String return the current command-line
getcmdpos() Number return cursor position in command-line
getcmdtype() String return current command-line type
getcmdwintype() String return current command-line window type
getcurpos() List position of the cursor
getcwd() String the current working directory
getcwd( [{scope}]) 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}
@ -1889,21 +1937,25 @@ inputdialog( {p} [, {t} [, {c}]]) 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}]
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}
jobclose({job}[, {stream}]) Number Closes a job stream(s)
jobpid({job}) Number Returns pid of a job.
jobresize({job}, {width}, {height})
jobclose( {job}[, {stream}]) Number Closes a job stream(s)
jobpid( {job}) Number Returns pid of a job.
jobresize( {job}, {width}, {height})
Number Resize {job}'s pseudo terminal window
jobsend({job}, {data}) Number Writes {data} to {job}'s stdin
jobstart({cmd}[, {opts}]) Number Spawns {cmd} as a job
jobstop({job}) Number Stops a job
jobwait({ids}[, {timeout}]) Number Wait for a set of jobs
jobsend( {job}, {data}) Number Writes {data} to {job}'s stdin
jobstart( {cmd}[, {opts}]) Number Spawns {cmd} as a job
jobstop( {job}) Number Stops a job
jobwait( {ids}[, {timeout}]) Number Wait for a set of jobs
join( {list} [, {sep}]) String join {list} items into one String
json_decode( {expr}) any Convert {expr} from JSON
json_encode( {expr}) String Convert {expr} to 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}
@ -1972,12 +2024,12 @@ 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}
rpcnotify({channel}, {event}[, {args}...])
rpcnotify( {channel}, {event}[, {args}...])
Sends a |msgpack-rpc| notification to {channel}
rpcrequest({channel}, {method}[, {args}...])
rpcrequest( {channel}, {method}[, {args}...])
Sends a |msgpack-rpc| request to {channel}
rpcstart({prog}[, {argv}]) Spawns {prog} and opens a |msgpack-rpc| channel
rpcstop({channel}) Closes a |msgpack-rpc| {channel}
rpcstart( {prog}[, {argv}]) Spawns {prog} and opens a |msgpack-rpc| channel
rpcstop( {channel}) Closes a |msgpack-rpc| {channel}
screenattr( {row}, {col}) Number attribute at screen position
screenchar( {row}, {col}) Number character at screen position
screencol() Number current cursor column
@ -1999,11 +2051,12 @@ setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val}
setcharsearch( {dict}) Dict set character search from {dict}
setcmdpos( {pos}) Number set cursor position in command-line
setline( {lnum}, {line}) Number set line {lnum} to {line}
setloclist( {nr}, {list}[, {action}])
setloclist( {nr}, {list}[, {action}[, {title}]])
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}
setqflist( {list}[, {action}[, {title}]]
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
@ -2028,7 +2081,7 @@ split( {expr} [, {pat} [, {keepempty}]])
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}
strchars( {expr} [, {skipcc}]) 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}])
@ -2193,17 +2246,17 @@ assert_equal({expected}, {actual}, [, {msg}])
assert_false({actual}, [, {msg}]) *assert_false()*
When {actual} is not false an error message is added to
|v:errors|, like with |assert_equal()|..
A value is false when it is zero. When "{actual}" is not a
number the assert fails.
|v:errors|, like with |assert_equal()|.
A value is false when it is zero or |v:false|. When "{actual}"
is not a number or |v:false| the assert fails.
When {msg} is omitted an error in the form "Expected False but
got {actual}" is produced.
assert_true({actual}, [, {msg}]) *assert_true()*
When {actual} is not true an error message is added to
|v:errors|, like with |assert_equal()|..
A value is true when it is a non-zeron number. When {actual}
is not a number the assert fails.
|v:errors|, like with |assert_equal()|.
A value is true when it is a non-zero number or |v:true|.
When {actual} is not a number or |v:true| the assert fails.
When {msg} is omitted an error in the form "Expected True but
got {actual}" is produced.
@ -2717,13 +2770,19 @@ 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.
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.
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.
A symbolic link itself is deleted, not what it points to.
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!
The result is a Number, which is 0 if the delete operation was
successful and -1 when the deletion failed or partly failed.
dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()*
Adds a watcher to a dictionary. A dictionary watcher is
@ -2797,9 +2856,8 @@ 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.
For a long |List| this is much faster than comparing the
length with zero.
items. A Number is empty when its value is zero. Special
variable is empty when it is |v:false| or |v:null|.
escape({string}, {chars}) *escape()*
Escape the characters in {chars} that occur in {string} with a
@ -3507,9 +3565,18 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but
MoveTheCursorAround
call setpos('.', save_cursor)
<
*getcwd()*
getcwd() The result is a String, which is the name of the current
working directory.
getcwd([{window}[, {tab}]]) *getcwd()*
With no arguments the result is a String, which is the name of
the current effective working directory. With {window} or
{tab} the working directory of that scope is returned.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing argument implies 0.
Thus the following are equivalent: >
getcwd()
getcwd(0)
getcwd(0, 0)
< If {window} is -1 it is ignored, only the tab is resolved.
getfsize({fname}) *getfsize()*
The result is a Number, which is the size in bytes of the
@ -3844,9 +3911,18 @@ 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([{window}[, {tab}]]) *haslocaldir()*
The result is a Number, which is 1 when the specified tabpage
or window has a local path set via |:lcd| or |:tcd|, and
0 otherwise.
Tabs and windows are identified by their respective numbers,
0 means current tab or window. Missing argument implies 0.
Thus the following are equivalent: >
haslocaldir()
haslocaldir(0)
haslocaldir(0, 0)
< If {window} is -1 it is ignored, only the tab is resolved.
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is 1 if there is a mapping that
@ -4262,6 +4338,46 @@ join({list} [, {sep}]) *join()*
converted into a string like with |string()|.
The opposite function is |split()|.
json_decode({expr}) *json_decode()*
Convert {expr} from JSON object. Accepts |readfile()|-style
list as the input, as well as regular string. May output any
Vim value. When 'encoding' is not UTF-8 string is converted
from UTF-8 to 'encoding', failing conversion fails
json_decode(). In the following cases it will output
|msgpack-special-dict|:
1. Dictionary contains duplicate key.
2. Dictionary contains empty key.
3. String contains NUL byte. Two special dictionaries: for
dictionary and for string will be emitted in case string
with NUL byte was a dictionary key.
Note: function treats its input as UTF-8 always regardless of
'encoding' value. This is needed because JSON source is
supposed to be external (e.g. |readfile()|) and JSON standard
allows only a few encodings, of which UTF-8 is recommended and
the only one required to be supported. Non-UTF-8 characters
are an error.
json_encode({expr}) *json_encode()*
Convert {expr} into a JSON string. Accepts
|msgpack-special-dict| as the input. Converts from 'encoding'
to UTF-8 when encoding strings. Will not convert |Funcref|s,
mappings with non-string keys (can be created as
|msgpack-special-dict|), values with self-referencing
containers, strings which contain non-UTF-8 characters,
pseudo-UTF-8 strings which contain codepoints reserved for
surrogate pairs (such strings are not valid UTF-8 strings).
When converting 'encoding' is taken into account, if it is not
"utf-8", then conversion is performed before encoding strings.
Non-printable characters are converted into "\u1234" escapes
or special escapes like "\t", other are dumped as-is.
Note: all characters above U+0079 are considered non-printable
when 'encoding' is not UTF-8. This function always outputs
UTF-8 strings as required by the standard thus when 'encoding'
is not unicode resulting string will look incorrect if
"\u1234" notation is not used.
keys({dict}) *keys()*
Return a |List| with all the keys of {dict}. The |List| is in
arbitrary order.
@ -4573,7 +4689,7 @@ match({expr}, {pat}[, {start}[, {count}]]) *match()*
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
@ -4581,6 +4697,8 @@ 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
@ -4598,9 +4716,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} argmument allows for further custom
values. Currently this is used to specify a match specifc
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| highlighed
matches, see |:syn-cchar|)
The number of matches is not limited, as it is the case with
the |:match| commands.
@ -4614,7 +4741,7 @@ matchadd({group}, {pattern}[, {priority}[, {id}]])
available from |getmatches()|. All matches can be deleted in
one operation by |clearmatches()|.
matchaddpos({group}, {pos}[, {priority}[, {id}]]) *matchaddpos()*
matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) *matchaddpos()*
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
@ -4778,7 +4905,7 @@ msgpackdump({list}) {Nvim} *msgpackdump()*
(dictionary with zero items is represented by 0x80 byte in
messagepack).
Limitations: *E951* *E952*
Limitations: *E951* *E952* *E953*
1. |Funcref|s cannot be dumped.
2. Containers that reference themselves cannot be dumped.
3. Dictionary keys are always dumped as STR strings.
@ -4813,9 +4940,13 @@ msgpackparse({list}) {Nvim} *msgpackparse()*
contains name of the key from |v:msgpack_types|):
Key Value ~
nil Zero, ignored when dumping.
boolean One or zero. When dumping it is only checked that
value is a |Number|.
nil Zero, ignored when dumping. This value cannot
possibly appear in |msgpackparse()| output in Neovim
versions which have |v:null|.
boolean One or zero. When dumping it is only checked that
value is a |Number|. This value cannot possibly
appear in |msgpackparse()| output in Neovim versions
which have |v:true| and |v:false|.
integer |List| with four numbers: sign (-1 or 1), highest two
bits, number with bits from 62nd to 31st, lowest 31
bits. I.e. to get actual number one will need to use
@ -5146,7 +5277,7 @@ readfile({fname} [, {binary} [, {max}]])
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/append} contains "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.
@ -5670,7 +5801,7 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()*
:call setbufvar("todo", "myvar", "foobar")
< This function is not available in the |sandbox|.
setcharsearch() *setcharsearch()*
setcharsearch({dict}) *setcharsearch()*
Set the current character search information to {dict},
which contains one or more of the following entries:
@ -5723,11 +5854,13 @@ setline({lnum}, {text}) *setline()*
:endfor
< Note: The '[ and '] marks are not set.
setloclist({nr}, {list} [, {action}]) *setloclist()*
setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()*
Create or replace or add to the location list for window {nr}.
When {nr} is zero the current window is used. For a location
list window, the displayed location list is modified. For an
invalid window number {nr}, -1 is returned.
invalid window number {nr}, -1 is returned. If {title} is
given, it will be used to set |w:quickfix_title| after opening
the location window.
Otherwise, same as |setqflist()|.
Also see |location-list|.
@ -5784,7 +5917,7 @@ setpos({expr}, {list})
|winrestview()|.
setqflist({list} [, {action}]) *setqflist()*
setqflist({list} [, {action}[, {title}]]) *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
@ -5823,6 +5956,9 @@ setqflist({list} [, {action}]) *setqflist()*
with the items from {list}. If {action} is not present or is
set to ' ', then a new list is created.
If {title} is given, it will be used to set |w:quickfix_title|
after opening the quickfix window.
Returns zero for success, -1 for failure.
This function can be used to create a quickfix list
@ -6109,7 +6245,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: >
@ -6157,15 +6294,35 @@ str2nr( {expr} [, {base}]) *str2nr()*
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()|.
{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
<
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.
@ -6221,25 +6378,31 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
{expr} type result ~
String 'string'
Number 123
Float 123.123456 or 1.123456e8
Funcref function('name')
Float 123.123456 or 1.123456e8 or
`str2float('inf')`
Funcref `function('name')`
List [item, item]
Dictionary {key: value, key: value}
Note that in String values the ' character is doubled.
Also see |strtrans()|.
Note 2: Output format is mostly compatible with YAML, except
for infinite and NaN floating-point values representations
which use |str2float()|. Strings are also dumped literally,
only single quote is escaped, which does not allow using YAML
for parsing back binary strings (including text when
'encoding' is not UTF-8). |eval()| should always work for
strings and floats though and this is the only official
method, use |msgpackdump()| or |json_encode()| if you need to
share data with other application.
*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()*
The result is a String, which is part of {src}, starting from
@ -6353,6 +6516,9 @@ 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
@ -6658,12 +6824,14 @@ trunc({expr}) *trunc()*
type({expr}) *type()*
The result is a Number, depending on the type of {expr}:
Number: 0
String: 1
Number: 0
String: 1
Funcref: 2
List: 3
List: 3
Dictionary: 4
Float: 5
Float: 5
Boolean: 6 (|v:true| and |v:false|)
Null: 7 (|v:null|)
To avoid the magic numbers it should be used this way: >
:if type(myvar) == type(0)
:if type(myvar) == type("")
@ -6671,6 +6839,10 @@ type({expr}) *type()*
:if type(myvar) == type([])
:if type(myvar) == type({})
:if type(myvar) == type(0.0)
:if type(myvar) == type(v:true)
< In place of checking for |v:null| type it is better to check
for |v:null| directly as it is the only value of this type: >
:if myvar is v:null
undofile({name}) *undofile()*
Return the name of the undo file that would be used for a file

View File

@ -1,4 +1,4 @@
*index.txt* For Vim version 7.4. Last change: 2015 Feb 12
*index.txt* For Vim version 7.4. Last change: 2015 Sep 08
VIM REFERENCE MANUAL by Bram Moolenaar

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 7.4. Last change: 2015 May 22
*insert.txt* For Vim version 7.4. Last change: 2015 Sep 15
VIM REFERENCE MANUAL by Bram Moolenaar
@ -78,8 +78,8 @@ CTRL-W Delete the word before the cursor (see |i_backspacing| about
|word-motions|, for the definition of a word.
*i_CTRL-U*
CTRL-U Delete all entered characters before the cursor in the current
line. If there are no newly entereed characters and
'backspace'is not empty, delete all characters before the
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*
@ -148,7 +148,7 @@ 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.

View File

@ -452,7 +452,7 @@ notation meaning equivalent decimal value(s) ~
<C-...> control-key *control* *ctrl* *<C-*
<M-...> alt-key or meta-key *meta* *alt* *<M-*
<A-...> same as <M-...> *<A-*
<D-...> command-key (Macintosh only) *<D-*
<D-...> command-key or "super" key *<D-*
<t_xx> key with "xx" entry in termcap
-----------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
The Msgpack-RPC Interface to Nvim *msgpack-rpc*
1. Introduction |msgpack-rpc-intro|
2. API |msgpack-rpc-api|
2. API mapping |msgpack-rpc-api|
3. Connecting |msgpack-rpc-connecting|
4. Clients |msgpack-rpc-clients|
5. Types |msgpack-rpc-types|
@ -36,13 +36,13 @@ Nvim's msgpack-rpc interface is like a more powerful version of Vim's
`clientserver` feature.
==============================================================================
2. API *msgpack-rpc-api*
2. API mapping *msgpack-rpc-api*
The Nvim C API is automatically exposed to the msgpack-rpc interface by the
build system, which parses headers at src/nvim/api from the project root. A
dispatch function is generated, which matches msgpack-rpc method names with
non-static API functions, converting/validating arguments and return values
back to msgpack.
The Nvim C API, see |nvim-api|, is automatically exposed to the msgpack-rpc
interface by the build system, which parses headers at src/nvim/api from the
project root. A dispatch function is generated, which matches msgpack-rpc method
names with non-static API functions, converting/validating arguments and return
values back to msgpack.
Client libraries will normally provide wrappers that hide msgpack-rpc details
from programmers. The wrappers can be automatically generated by reading
@ -63,7 +63,7 @@ Here's a simple way to get human-readable description of the API (requires
Python and the `pyyaml`/`msgpack-python` pip packages):
>
nvim --api-info | python -c 'import msgpack, sys, yaml; print yaml.dump(msgpack.unpackb(sys.stdin.read()))' > api.yaml
<
==============================================================================
3. Connecting *msgpack-rpc-connecting*
@ -162,8 +162,8 @@ https://github.com/msgpack-rpc/msgpack-rpc-ruby/blob/master/lib/msgpack/rpc/tran
==============================================================================
5. Types *msgpack-rpc-types*
Nvim's C API uses custom types for all functions (some are just typedefs
around C99 standard types). The types can be split into two groups:
Nvim's C API uses custom types for all functions, se |nvim-api-types|.
For the purpose of mapping to msgpack, he types can be split into two groups:
- Basic types that map natively to msgpack (and probably have a default
representation in msgpack-supported programming languages)

View File

@ -22,6 +22,8 @@ is found in your `$PATH`.
- xclip
- xsel (newer alternative to xclip)
- pbcopy/pbpaste (only for Mac OS X)
- lemonade (useful for SSH machine)
https://github.com/pocke/lemonade
The presence of a suitable clipboard tool implicitly enables the '+' and '*'
registers.

View File

@ -49,9 +49,12 @@ achieve special effects. These options come in three forms:
:se[t] {option}&vi Reset option to its Vi default value.
:se[t] {option}&vim Reset option to its Vim default value.
:se[t] all& Set all options, except terminal options, to their
default value. The values of 'term', 'lines' and
'columns' are not changed.
:se[t] all& Set all options to their default value. The values of
these options are not changed:
'columns'
'encoding'
'lines'
Warning: This may have a lot of side effects.
*:set-args* *E487* *E521*
:se[t] {option}={value} or
@ -704,7 +707,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}.
@ -772,14 +776,13 @@ A jump table for the options with a short description can be found at |Q_op|.
putting a ":gui" command in the gvimrc file, before where the value
of 'background' is used (e.g., before ":syntax on").
For Windows the default is "dark".
For other systems "dark" is used when 'term' is "linux",
"screen.linux", "cygwin" or "putty", or $COLORFGBG suggests a dark
background. Otherwise the default is "light".
For Windows the default is "dark". "dark" should be used if $COLORFGBG
suggests a dark background (not yet implemented). Otherwise the default
is "light".
Normally this option would be set in the vimrc file. Possibly
depending on the terminal name. Example: >
:if &term == "xterm"
:if $TERM == "xterm"
: set background=dark
:endif
< When this option is set, the default settings for the highlight groups
@ -1361,7 +1364,7 @@ A jump table for the options with a short description can be found at |Q_op|.
option, yank and delete operations (but not put)
will additionally copy the text into register
'*'. See |nvim-clipboard|.
<
*clipboard-autoselect*
autoselect Works like the 'a' flag in 'guioptions': If present,
then whenever Visual mode is started, or the Visual
@ -2274,6 +2277,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.
*'exrc'* *'ex'* *'noexrc'* *'noex'*
'exrc' 'ex' boolean (default off)
@ -4518,19 +4523,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
@ -4853,7 +4860,8 @@ 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 'paste' 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)
@ -4902,7 +4910,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|.
@ -5539,6 +5548,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
@ -5607,7 +5619,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
@ -5706,7 +5720,8 @@ 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: When 'paste' is set smart indenting is disabled.
This option is reset when 'paste' is set and restored when 'paste' is
reset.
*'smarttab'* *'sta'* *'nosmarttab'* *'nosta'*
'smarttab' 'sta' boolean (default on)
@ -5721,6 +5736,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.
*'softtabstop'* *'sts'*
'softtabstop' 'sts' number (default 0)
@ -5733,7 +5750,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
@ -6177,6 +6195,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.
@ -6370,17 +6389,7 @@ A jump table for the options with a short description can be found at |Q_op|.
mapping which should not change the tagstack.
*'term'* *E529* *E530* *E531*
'term' string (default is $TERM, if that fails:
in the GUI: "builtin_gui"
on Mac: "mac-ansi"
on Unix: "ansi"
on Windows: "win32")
global
Name of the terminal. Used for choosing the terminal control
characters. Environment variables are expanded |:set_env|.
For example: >
:set term=$TERM
< See |termcap|.
'term' Removed. |vim-differences| {Nvim}
*'termbidi'* *'tbidi'*
*'notermbidi'* *'notbidi'*
@ -6411,8 +6420,10 @@ A jump table for the options with a short description can be found at |Q_op|.
local to buffer
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.
@ -6560,9 +6571,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'ttyscroll' 'tsl' Removed. |vim-differences| {Nvim}
*'ttytype'* *'tty'*
'ttytype' 'tty' string (default from $TERM)
global
Alias for 'term', see above.
'ttytype' 'tty' Alias for 'term'. Removed. |vim-differences| {Nvim}
*'undodir'* *'udir'* *E926*
'undodir' 'udir' string (default "$XDG_DATA_HOME/nvim/undo")

View File

@ -1,279 +0,0 @@
*os_dos.txt* For Vim version 7.4. Last change: 2006 Mar 30
VIM REFERENCE MANUAL by Bram Moolenaar
*dos* *DOS*
This file documents some particularities of the Win32
version of Vim. Also see |os_win32.txt|.
1. File locations |dos-locations|
2. Using backslashes |dos-backslash|
3. Standard mappings |dos-standard-mappings|
4. Screen output and colors |dos-colors|
5. File formats |dos-file-formats|
6. :cd command |dos-:cd|
7. Interrupting |dos-CTRL-Break|
8. Temp files |dos-temp-files|
9. Shell option default |dos-shell|
==============================================================================
1. File locations *dos-locations*
If you keep the Vim executable in the directory that contains the help and
syntax subdirectories, there is no need to do anything special for Vim to
work. No registry entries or environment variables need to be set. Just make
sure that the directory is in your search path, or use a shortcut on the
desktop.
Your vimrc files ("_vimrc" and "_gvimrc") are normally located one directory
up from the runtime files. If you want to put them somewhere else, set the
environment variable $VIM to the directory where you keep them. Example: >
set VIM=C:\user\piet
Will find "c:\user\piet\_vimrc".
Note: This would only be needed when the computer is used by several people.
Otherwise it's simpler to keep your _vimrc file in the default place.
If you move the executable to another location, you also need to set the $VIM
environment variable. The runtime files will be found in "$VIM/vim{version}".
Example: >
set VIM=E:\vim
Will find the version 5.4 runtime files in "e:\vim\vim54".
Note: This is _not_ recommended. The preferred way is to keep the executable
in the runtime directory.
If you move your executable AND want to put your "_vimrc" and "_gvimrc" files
somewhere else, you must set $VIM to where you vimrc files are, and set
$VIMRUNTIME to the runtime files. Example: >
set VIM=C:\usr\piet
set VIMRUNTIME=E:\vim\vim54
Will find "c:\user\piet\_vimrc" and the runtime files in "e:\vim\vim54".
See |$VIM| and |$VIMRUNTIME| for more information.
You can set environment variables for each user separately under
"Start/Settings/Control Panel->System", or through the properties in the menu
of "My Computer", under the Environment Tab.
==============================================================================
2. Using backslashes *dos-backslash*
Using backslashes in file names can be a problem. Vi halves the number of
backslashes for some commands. Vim is a bit more tolerant and does not remove
backslashes from a file name, so ":e c:\foo\bar" works as expected. But when
a backslash occurs before a special character (space, comma, backslash, etc.),
Vim removes the backslash. Use slashes to avoid problems: ":e c:/foo/bar"
works fine. Vim replaces the slashes with backslashes internally to avoid
problems with some MS-DOS programs and Win32 programs.
When you prefer to use forward slashes, set the 'shellslash' option. Vim will
then replace backslashes with forward slashes when expanding file names. This
is especially useful when using a Unix-like 'shell'.
==============================================================================
3. Standard mappings *dos-standard-mappings*
The mappings for CTRL-PageUp and CTRL-PageDown have been removed, they now
jump to the next or previous tab page |<C-PageUp>| |<C-PageDown>|
If you want them to move to the first and last screen line you can use these
mappings:
key key code Normal/Visual mode Insert mode ~
CTRL-PageUp <M-N><M-C-D> H <C-O>H
CTRL-PageDown <M-N>v L$ <C-O>L<C-O>$
Additionally, these keys are available for copy/cut/paste.
In the Win32 version, they also use the clipboard.
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>*
These mappings accomplish this (Win32 version of Vim):
key key code Normal Visual Insert ~
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
Or these mappings (non-Win32 version of Vim):
key key code Normal Visual Insert ~
Shift-Insert <M-N><M-T> P "-dP <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
When the clipboard is supported, the "* register is used.
==============================================================================
4. Screen output and colors *dos-colors*
The default output method for the screen is to use bios calls. This works
right away on most systems. You do not need ansi.sys. You can use ":mode" to
set the current screen mode. See |:mode|.
To change the screen colors that Vim uses, you can use the |:highlight|
command. The Normal highlight group specifies the colors Vim uses for normal
text. For example, to get grey text on a blue background: >
:hi Normal ctermbg=Blue ctermfg=grey
See |highlight-groups| for other groups that are available.
A DOS console does not support attributes like bold and underlining. You can
set the color used in five modes with nine terminal options. Note that this
is not necessary since you can set the color directly with the ":highlight"
command; these options are for backward compatibility with older Vim versions.
The |'highlight'| option specifies which of the five modes is used for which
action. >
:set t_mr=^V^[\|xxm start of invert mode
:set t_md=^V^[\|xxm start of bold mode
:set t_me=^V^[\|xxm back to normal text
:set t_so=^V^[\|xxm start of standout mode
:set t_se=^V^[\|xxm back to normal text
:set t_us=^V^[\|xxm start of underline mode
:set t_ue=^V^[\|xxm back to normal text
:set t_ZH=^V^[\|xxm start of italics mode
:set t_ZR=^V^[\|xxm back to normal text
^V is CTRL-V
^[ is <Esc>
You must replace xx with a decimal code, which is the foreground color number
and background color number added together:
COLOR FOREGROUND BACKGROUND ~
Black 0 0
DarkBlue 1 16
DarkGreen 2 32
DarkCyan 3 48
DarkRed 4 64
DarkMagenta 5 80
Brown, DarkYellow 6 96
LightGray 7 112
DarkGray 8 128 *
Blue, LightBlue 9 144 *
Green, LightGreen 10 160 *
Cyan, LightCyan 11 176 *
Red, LightRed 12 192 *
Magenta, LightMagenta 13 208 *
Yellow, LightYellow 14 224 *
White 15 240 *
* Depending on the display mode, the color codes above 128 may not be
available, and code 128 will make the text blink.
When you use 0, the color is reset to the one used when you started Vim
(usually 7, lightgray on black, but you can override this. If you have
overridden the default colors in a command prompt, you may need to adjust
some of the highlight colors in your vimrc---see below).
This is the default for t_me.
The defaults for the various highlight modes are:
t_mr 112 reverse mode: Black text (0) on LightGray (112)
t_md 15 bold mode: White text (15) on Black (0)
t_me 0 normal mode (revert to default)
t_so 31 standout mode: White (15) text on DarkBlue (16)
t_se 0 standout mode end (revert to default)
t_czh 225 italic mode: DarkBlue text (1) on Yellow (224)
t_czr 0 italic mode end (revert to default)
t_us 67 underline mode: DarkCyan text (3) on DarkRed (64)
t_ue 0 underline mode end (revert to default)
These colors were chosen because they also look good when using an inverted
display, but you can change them to your liking.
Example: >
:set t_mr=^V^[\|97m " start of invert mode: DarkBlue (1) on Brown (96)
:set t_md=^V^[\|67m " start of bold mode: DarkCyan (3) on DarkRed (64)
:set t_me=^V^[\|112m " back to normal mode: Black (0) on LightGray (112)
:set t_so=^V^[\|37m " start of standout mode: DarkMagenta (5) on DarkGreen
(32)
:set t_se=^V^[\|112m " back to normal mode: Black (0) on LightGray (112)
==============================================================================
5. File formats *dos-file-formats*
If the 'fileformat' option is set to "dos" (which is the default), Vim accepts
a single <NL> or a <CR><NL> pair for end-of-line (<EOL>). When writing a
file, Vim uses <CR><NL>. Thus, if you edit a file and write it, Vim replaces
<NL> with <CR><NL>.
If the 'fileformat' option is set to "unix", Vim uses a single <NL> for <EOL>
and shows <CR> as ^M.
You can use Vim to replace <NL> with <CR><NL> by reading in any mode and
writing in Dos mode (":se ff=dos").
You can use Vim to replace <CR><NL> with <NL> by reading in Dos mode and
writing in Unix mode (":se ff=unix").
Vim sets 'fileformat' automatically when 'fileformats' is not empty (which is
the default), so you don't really have to worry about what you are doing.
|'fileformat'| |'fileformats'|
If you want to edit a script file or a binary file, you should set the
'binary' option before loading the file. Script files and binary files may
contain single <NL> characters which Vim would replace with <CR><NL>. You can
set 'binary' automatically by starting Vim with the "-b" (binary) option.
==============================================================================
6. :cd command *dos-:cd*
The ":cd" command recognizes the drive specifier and changes the current
drive. Use ":cd c:" to make drive C the active drive. Use ":cd d:\foo" to go
to the directory "foo" in the root of drive D. Vim also recognizes UNC names
if the system supports them; e.g., ":cd \\server\share\dir". |:cd|
==============================================================================
7. Interrupting *dos-CTRL-Break*
Use CTRL-Break instead of CTRL-C to interrupt searches. Vim does not detect
the CTRL-C until it tries to read a key.
==============================================================================
8. Temp files *dos-temp-files*
Vim uses standard Windows functions to obtain a temporary file name (for
filtering). The first of these directories that exists and in which Vim can
create a file is used:
$TMP
$TEMP
current directory
==============================================================================
9. Shell option default *dos-shell*
The default for the 'sh' ('shell') option is "cmd.exe" on Windows.
If SHELL is defined, Vim uses SHELL instead, and if SHELL is not defined
but COMSPEC is, Vim uses COMSPEC. Vim starts external commands with
"<shell> /c <command_name>". Typing CTRL-Z starts a new command
subshell. Return to Vim with "exit". |'shell'| |CTRL-Z|
If you are running a third-party shell, you may need to set the
|'shellcmdflag'| ('shcf') and |'shellquote'| ('shq') or |'shellxquote'|
('sxq') options. Unfortunately, this also depends on the version of Vim used.
For example, with the MKS Korn shell or with bash, the values of the options
on Win32 should be:
'shellcmdflag' -c
'shellquote' (empty)
'shellxquote' "
For Win32, this starts the shell as:
<shell> -c "command name >file"
When starting up, Vim checks for the presence of "sh" anywhere in the 'shell'
option. If it is present, Vim sets the 'shellcmdflag' and 'shellquote' or
'shellxquote' options will be set as described above.
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.4. Last change: 2014 Mar 27
*quickfix.txt* For Vim version 7.4. Last change: 2015 Sep 08
VIM REFERENCE MANUAL by Bram Moolenaar
@ -302,16 +302,22 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
etc.
< When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected on one buffer, further
buffers will not be visited.
When an error is detected excecution 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} {not available when compiled without the
|+listcmds| feature}
Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|,
|:ldo|, |:cfdo| and |:lfdo|.
@ -323,20 +329,9 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:cnfile
:{cmd}
etc.
< When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected on one buffer, further
buffers will not be visited.
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.
Note: While this command is executing, the Syntax
autocommand event is disabled by adding it to
'eventignore'. This considerably speeds up editing
each buffer.
Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|,
|:cdo|, |:ldo| and |:lfdo|.
< Otherwise it works the same as `:cdo`.
{not in Vi} {not available when compiled without the
|+listcmds| feature}
*:ldo*
:ld[o][!] {cmd} Execute {cmd} in each valid entry in the location list
@ -347,20 +342,10 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:lnext
:{cmd}
etc.
< When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected on one buffer, further
buffers will not be visited.
The last buffer (or where an error occurred) becomes
the current buffer.
{cmd} can contain '|' to concatenate several commands.
Only valid entries in the location list are used.
Note: While this command is executing, the Syntax
autocommand event is disabled by adding it to
'eventignore'. This considerably speeds up editing
each buffer.
Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|,
|:cdo|, |:cfdo| and |:lfdo|.
< Only valid entries in the location list are used.
Otherwise it works the same as `:cdo`.
{not in Vi} {not available when compiled without the
|+listcmds| feature}
*:lfdo*
:lfdo[!] {cmd} Execute {cmd} in each file in the location list for
@ -371,20 +356,9 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:lnfile
:{cmd}
etc.
< When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected on one buffer, further
buffers will not be visited.
The last buffer (or where an error occurred) becomes
the current buffer.
{cmd} can contain '|' to concatenate several commands.
Only valid entries in the location list are used.
Note: While this command is executing, the Syntax
autocommand event is disabled by adding it to
'eventignore'. This considerably speeds up editing
each buffer.
Also see |:bufdo|, |:tabdo|, |:argdo|, |:windo|,
|:cdo|, |:ldo| and |:cfdo|.
< Otherwise it works the same as `:ldo`.
{not in Vi} {not available when compiled without the
|+listcmds| feature}
=============================================================================
2. The error window *quickfix-window*

View File

@ -1,4 +1,4 @@
*quickref.txt* For Vim version 7.4. Last change: 2014 Nov 19
*quickref.txt* For Vim version 7.4. Last change: 2015 Jul 21
VIM REFERENCE MANUAL by Bram Moolenaar
@ -617,6 +617,7 @@ Short explanation of each option: *option-list*
'balloondelay' 'bdlay' delay in mS before a balloon may pop up
'ballooneval' 'beval' switch on balloon evaluation
'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
'bomb' prepend a Byte Order Mark to the file
'breakat' 'brk' characters that may cause a line break
@ -688,6 +689,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
@ -702,10 +704,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
'gdefault' 'gd' the ":substitute" flag 'g' is default on
'grepformat' 'gfm' format of 'grepprg' output
@ -873,9 +875,9 @@ 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
'taglength' 'tl' number of significant characters for a tag
'tagrelative' 'tr' file names in tag file are relative

View File

@ -109,6 +109,12 @@ q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"}
while executing a register, and it doesn't work inside
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.
q Stops recording.
Implementation note: The 'q' that stops recording is
not stored in the register, unless it was the result

View File

@ -217,7 +217,7 @@ argument.
:set to display option values.
When 'verbose' is non-zero messages are printed (for
debugging, to stderr).
'term' and $TERM are not used.
$TERM is not used.
If Vim appears to be stuck try typing "qa!<Enter>". You don't
get a prompt thus you can't see Vim is waiting for you to type
something.
@ -315,9 +315,10 @@ argument.
When {vimrc} is equal to "NONE" (all uppercase), all
initializations from files and environment variables are
skipped, including reading the |ginit.vim| file when the GUI
starts. Loading plugins is also skipped.
starts. Plugins and syntax highlighting are also skipped.
When {vimrc} is equal to "NORC" (all uppercase), this has the
same effect as "NONE", but loading plugins is not skipped.
same effect as "NONE", but plugins and syntax highlighting are
not skipped.
*-i*
-i {shada} The file {shada} is used instead of the default ShaDa
@ -354,13 +355,10 @@ argument.
At startup, Vim checks environment variables and files and sets values
accordingly. Vim proceeds in this order:
1. Set the 'shell' and 'term' option *SHELL* *COMSPEC* *TERM*
1. Set the 'shell' option *SHELL* *COMSPEC* *TERM*
The environment variable SHELL, if it exists, is used to set the
'shell' option. On Windows, the COMSPEC variable is used
if SHELL is not set.
The environment variable TERM, if it exists, is used to set the 'term'
option. However, 'term' will change later when starting the GUI (step
8 below).
2. Process the arguments
The options and file names from the command that start Vim are
@ -382,6 +380,8 @@ accordingly. Vim proceeds in this order:
Places for your personal initializations:
Unix $XDG_CONFIG_HOME/nvim/init.vim
(default for $XDG_CONFIG_HOME is ~/.config)
Windows $XDG_CONFIG_HOME/nvim/init.vim
(default for $XDG_CONFIG_HOME is ~/AppData/Local)
The files are searched in the order specified above and only the first
one that is found is read.
@ -394,7 +394,8 @@ accordingly. Vim proceeds in this order:
All following initializations until 4. are skipped. $MYVIMRC is not
set.
"vim -u NORC" can be used to skip these initializations without
reading a file. "vim -u NONE" also skips loading plugins. |-u|
reading a file. "vim -u NONE" also skips plugins and syntax
highlighting. |-u|
If Vim was started in Ex mode with the "-s" argument, all following
initializations until 4. are skipped. Only the "-u" option is
@ -427,7 +428,22 @@ accordingly. Vim proceeds in this order:
- The file ".exrc" (for Unix)
"_exrc" (for Win32)
4. Load the plugin scripts. *load-plugins*
4. Enable filetype and indent plugins.
This does the same as the commands: >
:runtime! filetype.vim
:runtime! ftplugin.vim
:runtime! indent.vim
< This step is skipped if ":filetype ..." was called before now or if
the "-u NONE" command line argument was given.
5. Enable syntax highlighting.
This does the same as the command: >
:runtime! syntax/syntax.vim
< Note: This enables filetype detection even if ":filetype off" was
called before now.
This step is skipped if the "-u NONE" command line argument was given.
6. Load the plugin scripts. *load-plugins*
This does the same as the command: >
:runtime! plugin/**/*.vim
< The result is that all directories in the 'runtimepath' option will be
@ -443,31 +459,30 @@ accordingly. Vim proceeds in this order:
commands from the command line have not been executed yet. You can
use "--cmd 'set noloadplugins'" |--cmd|.
5. Set 'shellpipe' and 'shellredir'
7. Set 'shellpipe' and 'shellredir'
The 'shellpipe' and 'shellredir' options are set according to the
value of the 'shell' option, unless they have been set before.
This means that Vim will figure out the values of 'shellpipe' and
'shellredir' for you, unless you have set them yourself.
6. Set 'updatecount' to zero, if "-n" command argument used
8. Set 'updatecount' to zero, if "-n" command argument used
7. Set binary options
9. Set binary options
If the "-b" flag was given to Vim, the options for binary editing will
be set now. See |-b|.
8. Perform GUI initializations
10. Perform GUI initializations
Only when starting "gvim", the GUI initializations will be done. See
|gui-init|.
9. Read the ShaDa file
If the 'shada' option is not empty, the ShaDa file is read. See
|shada-file|.
11. Read the ShaDa file
See |shada-file|.
10. Read the quickfix file
12. Read the quickfix file
If the "-q" flag was given to Vim, the quickfix file is read. If this
fails, Vim exits.
11. Open all windows
13. Open all windows
When the |-o| flag was given, windows will be opened (but not
displayed yet).
When the |-p| flag was given, tab pages will be created (but not
@ -476,7 +491,7 @@ accordingly. Vim proceeds in this order:
If the "-q" flag was given to Vim, the first error is jumped to.
Buffers for all windows will be loaded.
12. Execute startup commands
14. 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.
@ -705,8 +720,8 @@ vimrc file.
These commands will write ":map" and ":set" commands to a file, in such a way
that when these commands are executed, the current key mappings and options
will be set to the same values. The options 'columns', 'endofline',
'fileformat', 'lines', 'modified', 'scroll', and 'term' are not included,
because these are terminal or file dependent.
'fileformat', 'lines', 'modified', and 'scroll' are not included, because
these are terminal or file dependent.
Note that the options 'binary', 'paste' and 'readonly' are included, this
might not always be what you want.

View File

@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.4. Last change: 2015 Mar 29
*syntax.txt* For Vim version 7.4. Last change: 2015 Sep 29
VIM REFERENCE MANUAL by Bram Moolenaar
@ -417,18 +417,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.
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.
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: >
@ -742,6 +743,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).
@ -3430,7 +3447,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: >
@ -3684,6 +3701,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 with with |matchadd()|.
concealends *:syn-concealends*

View File

@ -273,8 +273,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
@ -282,8 +282,8 @@ When switching to another tab page the order is:
BufLeave
WinLeave
TabLeave
TabEnter
WinEnter
TabEnter
BufEnter
When entering a new tab page (|:tabnew|), TabNew is triggered before TabEnter

View File

@ -250,8 +250,8 @@ ignored if its owner differs from the owner of the edited file, except when
the owner of the undo file is the current user. Set 'verbose' to get a
message about that when opening a file.
Undo files are normally saved in the same directory as the file. This can be
changed with the 'undodir' option.
Location of the undo files is controlled by the 'undodir' option, by default
they are saved to the dedicated directory in the application data folder.
You can also save and restore undo histories by using ":wundo" and ":rundo"
respectively:

View File

@ -37,9 +37,10 @@ for you), you can edit it this way: >
If you don't have a vimrc file yet, see |init.vim| to find out where you can
create a vimrc file.
For Unix and Macintosh this file is always used and is recommended:
This file is always used and is recommended:
~/.config/nvim/init.vim ~
~/.config/nvim/init.vim (Unix and OSX) ~
~/AppData/Local/nvim/init.vim (Windows) ~
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

View File

@ -152,7 +152,7 @@ You could also write your own color scheme. This is how you do it:
directory. For Unix, this should work: >
!mkdir -p ~/.config/nvim/colors
!cp $VIMRUNTIME/colors/morning.vim ~/.vim/colors/mine.vim
!cp $VIMRUNTIME/colors/morning.vim ~/.config/nvim/colors/mine.vim
<
This is done from Vim, because it knows the value of $VIMRUNTIME.

View File

@ -222,6 +222,10 @@ g8 Print the hex values of the bytes used in the
modified, but can be forced with "!". See |termopen()|
and |nvim-terminal-emulator| for more information.
To switch to terminal mode automatically:
>
autocmd BufEnter term://* startinsert
<
*:!cmd* *:!* *E34*
:!{cmd} Execute {cmd} with 'shell'. See also |:terminal|.

View File

@ -11,7 +11,7 @@ the "{Nvim}" tag. This document is a complete and centralized list of all
these differences.
1. Configuration |nvim-configuration|
2. Option defaults |nvim-option-defaults|
2. Defaults |nvim-defaults|
3. Changed features |nvim-features-changed|
4. New features |nvim-features-new|
5. Missing legacy features |nvim-features-missing|
@ -21,14 +21,17 @@ these differences.
==============================================================================
1. Configuration *nvim-configuration*
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for storing
- Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for storing
configuration.
- Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files.
- Use `$XDG_DATA_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent
- Use `$XDG_DATA_HOME/nvim/shada/main.shada` instead of `.viminfo` for persistent
session information.
==============================================================================
2. Option defaults *nvim-option-defaults*
2. Defaults *nvim-defaults*
- Syntax highlighting is enabled by default
- ":filetype plugin indent on" is enabled by default
- 'autoindent' is set by default
- 'autoread' is set by default
@ -45,7 +48,7 @@ these differences.
- 'listchars' defaults to "tab:> ,trail:-,nbsp:+"
- 'mouse' defaults to "a"
- 'nocompatible' is always set
- 'nrformats' defaults to "hex"
- 'nrformats' defaults to "bin,hex"
- 'sessionoptions' doesn't include "options"
- 'smarttab' is set by default
- 'tabpagemax' defaults to 50
@ -68,54 +71,72 @@ are always available and may be used simultaneously in separate plugins. The
|nvim-python|).
|mkdir()| behaviour changed:
1. Assuming /tmp/foo does not exist and /tmp can be written to
1. Assuming /tmp/foo does not exist and /tmp can be written to
mkdir('/tmp/foo/bar', 'p', 0700) will create both /tmp/foo and /tmp/foo/bar
with 0700 permissions. Vim mkdir will create /tmp/foo with 0755.
2. If you try to create an existing directory with `'p'` (e.g. mkdir('/',
2. If you try to create an existing directory with `'p'` (e.g. mkdir('/',
'p')) mkdir() will silently exit. In Vim this was an error.
3. mkdir() error messages now include strerror() text when mkdir fails.
'encoding' cannot be changed after startup.
|string()| and |:echo| behaviour changed:
1. No maximum recursion depth limit is applied to nested container
1. No maximum recursion depth limit is applied to nested container
structures.
2. |string()| fails immediately on nested containers, not when recursion limit
2. |string()| fails immediately on nested containers, not when recursion limit
was exceeded.
2. When |:echo| encounters duplicate containers like >
let l = []
echo [l, l]
<
it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is
it does not use "[...]" (was: "[[], [...]]", now: "[[], []]"). "..." is
only used for recursive containers.
3. |:echo| printing nested containers adds "@level" after "..." designating
the level at which recursive container was printed: |:echo-self-refer|.
Same thing applies to |string()| (though it uses construct like
"{E724@level}"), but this is not reliable because |string()| continues to
3. |:echo| printing nested containers adds "@level" after "..." designating
the level at which recursive container was printed: |:echo-self-refer|.
Same thing applies to |string()| (though it uses construct like
"{E724@level}"), but this is not reliable because |string()| continues to
error out.
4. Stringifyed infinite and NaN values now use |str2float()| and can be evaled
back.
5. (internal) Trying to print or stringify VAR_UNKNOWN in Vim results in
nothing, |E908|, in Neovim it is internal error.
Viminfo text files were replaced with binary (messagepack) ShaDa files.
|json_decode()| behaviour changed:
1. It may output |msgpack-special-dict|.
2. |msgpack-special-dict| is emitted also in case of duplicate keys, while in
Vim it errors out.
3. It accepts only valid JSON. Trailing commas are not accepted.
|json_encode()| behaviour slightly changed: now |msgpack-special-dict| values
are accepted, but |v:none| is not.
*v:none* variable is absent. In Vim it represents “no value” in “js” strings
like "[,]" parsed as "[v:none]" by |js_decode()|.
*js_encode()* and *js_decode()* functions are also absent.
Viminfo text files were replaced with binary (messagepack) ShaDa files.
Additional differences:
- |shada-c| has no effect.
- |shada-s| now limits size of every item and not just registers.
- When reading ShaDa files items are merged according to the timestamp.
- When reading ShaDa files items are merged according to the timestamp.
|shada-merging|
- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for
- 'viminfo' option got renamed to 'shada'. Old option is kept as an alias for
compatibility reasons.
- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old
- |:wviminfo| was renamed to |:wshada|, |:rviminfo| to |:rshada|. Old
commands are still kept.
- |:oldfiles| supports !.
- When writing (|:wshada| without bang or at exit) it merges much more data,
and does this according to the timestamp. Vim merges only marks.
- When writing (|:wshada| without bang or at exit) it merges much more data,
and does this according to the timestamp. Vim merges only marks.
|shada-merging|
- ShaDa file format was designed with forward and backward compatibility in
- ShaDa file format was designed with forward and backward compatibility in
mind. |shada-compatibility|
- Some errors make ShaDa code keep temporary file in-place for user to decide
what to do with it. Vim deletes temporary file in these cases.
- Some errors make ShaDa code keep temporary file in-place for user to decide
what to do with it. Vim deletes temporary file in these cases.
|shada-error-handling|
- Vim keeps no timestamps at all, neither in viminfo file nor in the instance
- Vim keeps no timestamps at all, neither in viminfo file nor in the instance
itself.
- ShaDa file keeps search direction (|v:searchforward|), viminfo does not.
@ -134,8 +155,8 @@ Meta (alt) chords are recognized (even in the terminal).
Note: Meta chords are case-sensitive (<M-a> is distinguished from <M-A>).
Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants (even in
the terminal). Specifically, the following are known to work:
Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants
(even in the terminal). Specifically, the following are known to work:
<C-Tab>, <C-S-Tab>
<C-BS>, <C-S-BS>
<C-Enter>, <C-S-Enter>
@ -207,6 +228,7 @@ Other options:
'shelltype'
'shortname'
'swapsync'
'term'
'termencoding' (Vim 7.4.852 also removed this for Windows)
'textauto'
'textmode'
@ -214,6 +236,8 @@ Other options:
'toolbariconsize'
'ttybuiltin'
'ttymouse'
'ttyscroll'
'ttytype'
'weirdinvert'
Other commands:

View File

@ -1,4 +1,4 @@
*windows.txt* For Vim version 7.4. Last change: 2015 Jan 31
*windows.txt* For Vim version 7.4. Last change: 2015 Aug 29
VIM REFERENCE MANUAL by Bram Moolenaar
@ -706,7 +706,7 @@ can also get to them with the buffer list commands, like ":bnext".
*:bufdo*
:[range]bufdo[!] {cmd} Execute {cmd} in each buffer in the buffer list or if
[range[ is given only for buffers for which their
[range] is given only for buffers for which their
buffer name is in the [range]. It works like doing
this: >
:bfirst
@ -1099,13 +1099,13 @@ list of buffers. |unlisted-buffer|
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|.
Also see |+cmd|.
:[N]b[uffer][!] [+cmd] {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.
Also see ||+cmd|.
Also see |+cmd|.
:[N]sb[uffer] [+cmd] [N] *:sb* *:sbuffer*
Split window and edit buffer [N] from the buffer list. If [N]
@ -1113,7 +1113,7 @@ list of buffers. |unlisted-buffer|
"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|.
Also see |+cmd|.
:[N]sb[uffer] [+cmd] {bufname}
Split window and edit buffer for {bufname} from the buffer
@ -1122,13 +1122,13 @@ list of buffers. |unlisted-buffer|
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|.
< Also see |+cmd|.
:[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|.
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.
@ -1141,21 +1141,21 @@ list of buffers. |unlisted-buffer|
:[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|.
Also see |+cmd|.
:[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|.
Also see |+cmd|.
:[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|.
Also see |+cmd|.
:br[ewind][!] [+cmd] *:br* *:brewind*
Go to first buffer in buffer list. If the buffer list is

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2015 Apr 06
" Last Change: 2015 Oct 13
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@ -139,7 +139,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
@ -304,6 +304,9 @@ 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,BUILD,WORKSPACE setfiletype bzl
" C or lpc
au BufNewFile,BufRead *.c call s:FTlpc()
@ -822,7 +825,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
@ -868,7 +871,7 @@ func! s:FThtml()
setf xhtml
return
endif
if getline(n) =~ '{%\s*\(extends\|block\|load\)\>'
if getline(n) =~ '{%\s*\(extends\|block\|load\)\>\|{#\s\+'
setf htmldjango
return
endif
@ -1164,7 +1167,7 @@ func! s:FTm()
let n = 1
while n < 10
let line = getline(n)
if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)'
if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\|//\)'
setf objc
return
endif
@ -1332,7 +1335,7 @@ func! s:FTmm()
let n = 1
while n < 10
let line = getline(n)
if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)'
if line =~ '^\s*\(#\s*\(include\|import\)\>\|@import\>\|/\*\)'
setf objcpp
return
endif
@ -1855,7 +1858,7 @@ au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog')
" Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc.
" Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts
au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash_profile*,.bash_logout*,.bash_aliases*,*.bash,*.ebuild,PKGBUILD* call SetFileTypeSH("bash")
au BufNewFile,BufRead .bashrc*,bashrc,bash.bashrc,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass call SetFileTypeSH("bash")
au BufNewFile,BufRead .kshrc*,*.ksh call SetFileTypeSH("ksh")
au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call SetFileTypeSH(getline(1))
@ -2119,6 +2122,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
@ -2174,6 +2180,9 @@ 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

94
runtime/ftplugin/bzl.vim Normal file
View File

@ -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

View File

@ -2,7 +2,7 @@
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" URL: https://github.com/glts/vim-j
" Last Change: 2015-03-27
" Last Change: 2015-09-27
if exists('b:did_ftplugin')
finish
@ -12,13 +12,20 @@ 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 matchpairs=(:)
setlocal path-=/usr/include
let b:undo_ftplugin = 'setlocal matchpairs< 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.

View File

@ -24,11 +24,11 @@ setlocal buftype=nofile noswapfile
setlocal nomodifiable readonly bufhidden=hide nobuflisted tabstop=8
if !exists("g:no_plugin_maps") && !exists("g:no_man_maps")
nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count)<CR>
nnoremap <silent> <buffer> <C-]> :call man#get_page(v:count, expand('<cword>'))<CR>
nnoremap <silent> <buffer> <C-T> :call man#pop_page()<CR>
nnoremap <silent> <nowait><buffer> q <C-W>c
if &keywordprg !=# ':Man'
nnoremap <silent> <buffer> K :call man#get_page(v:count)<CR>
nnoremap <silent> <buffer> K :call man#get_page(v:count, expand('<cword>'))<CR>
endif
endif

View File

@ -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: Fri Feb 20 16:01 MSK 2014 Igor Gnatenko
" Last Change: Mon Jun 01 21:15 MSK 2015 Igor Gnatenko
if exists("b:did_ftplugin")
finish

View File

@ -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

97
runtime/indent/bzl.vim Normal file
View File

@ -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

View File

@ -2,7 +2,7 @@
" Header: "{{{
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
" Last Change: 2015 Jun 12
" Last Change: 2015 Sep 25
" Version: 1.0
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@ -178,13 +178,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".
@ -257,6 +259,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
@ -291,7 +294,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\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
call substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\[\|\[endif\]-->\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
let s:countonly = 0
endfunc "}}}
@ -303,7 +306,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\+\(-\w\+\)*\>\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
let tmp = substitute(a:text, '<\zs/\=\w\+\(-\w\+\)*\>\|<!--\[\|\[endif\]-->\|<!--\|-->', '\=s:CheckTag(submatch(0))', 'g')
if s:block == 3
let b:hi_newstate.scripttype = s:GetScriptType(matchstr(tmp, '\C.*<SCRIPT\>\zs[^>]*'))
endif
@ -425,7 +428,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)
@ -464,10 +467,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] != "/"
@ -487,23 +493,29 @@ 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()
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]))
if found == 2
let state.baseindent = b:hi_indent.baseindent
endif
let state.blocktagind = indent(comlnum) + (s:curind + s:nextrel) * s:ShiftWidth()
return state
endif
@ -819,6 +831,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 + s:ShiftWidth()
endfunc "}}}
" When the "lnum" line ends in ">" find the line containing the matching "<".
func! HtmlIndent_FindTagStart(lnum)
"{{{

View File

@ -1,8 +1,11 @@
" Vim indent file
" Language: Shell Script
" Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2014-08-22
" Language: Shell Script
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
" Original Author: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2015-07-28
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-sh-indent
if exists("b:did_indent")
finish
@ -10,7 +13,7 @@ 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
@ -54,8 +57,8 @@ function! GetShIndent()
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*\%(#.*\)\=$'
if line =~ '^\s*\%(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)
@ -76,7 +79,7 @@ function! GetShIndent()
let pine = 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\)\>' || line =~ '^\s*}'
let ind -= s:indent_value('default')
elseif line =~ '^\s*esac\>' && s:is_case_empty(getline(v:lnum - 1))
let ind -= s:indent_value('default')

View File

@ -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

View File

@ -0,0 +1,67 @@
" Vim indent file
" Language: Tera Term Language (TTL)
" Based on Tera Term Version 4.86
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
" Last Change: 2015 Jun 4
" 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')
function s:sw() abort
return shiftwidth()
endfunction
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\s*$'
" 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

View File

@ -1,6 +1,7 @@
" Vim indent file
" Language: YAML
" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
" Last Change: 2015 Sep 25
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@ -115,8 +116,13 @@ 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

View File

@ -4,7 +4,7 @@ rem Read stdin if no arguments were given.
rem Written by Ken Takata.
if "%1"=="" (
vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" -
nvim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" -
) else (
vim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %*
nvim --cmd "let no_plugin_maps = 1" -c "runtime! macros/less.vim" %*
)

View File

@ -8,9 +8,9 @@ if test -t 1; then
echo "Missing filename" 1>&2
exit
fi
vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' -
nvim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' -
else
vim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@"
nvim --cmd 'let no_plugin_maps = 1' -c 'runtime! macros/less.vim' "$@"
fi
else
# Output is not a terminal, cat arguments or stdin

View File

@ -177,6 +177,7 @@ 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

View File

@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2014 Nov 19
" Last Change: 2015 Jul 22
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@ -673,6 +673,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)
@ -922,7 +924,7 @@ 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("$", "fixeol\tfixes missing end-of-line at end of text file")
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")

View File

@ -303,7 +303,7 @@ fun! s:CleanUp(options, mode, startline, startcol, ...)
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"
call cursor(0, endcol)
endif
endif " a:0
endif " a:mode != "o" && etc.

View File

@ -1,5 +1,16 @@
if exists('loaded_remote_plugins') || &cp
if exists('g:loaded_remote_plugins')
finish
endif
let loaded_remote_plugins = 1
call remote#host#LoadRemotePlugins()
let g:loaded_remote_plugins = 1
command! UpdateRemotePlugins call remote#host#UpdateRemotePlugins()
augroup nvim-rplugin
autocmd!
autocmd FuncUndefined *
\ call remote#host#LoadRemotePluginsEvent(
\ 'FuncUndefined', expand('<amatch>'))
autocmd CmdUndefined *
\ call remote#host#LoadRemotePluginsEvent(
\ 'CmdUndefined', expand('<amatch>'))
augroup END

View File

@ -1,15 +1,8 @@
" Vim plugin for downloading spell files
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2006 Feb 01
" Exit quickly when:
" - this plugin was already loaded
" - when 'compatible' is set
" - some autocommands are already taking care of spell files
if exists("loaded_spellfile_plugin") || &cp || exists("#SpellFileMissing")
finish
endif
let loaded_spellfile_plugin = 1
" The function is in the autoload directory.
autocmd SpellFileMissing * call spellfile#LoadFile(expand('<amatch>'))

View File

@ -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
"}}}
"}}}

View File

@ -161,6 +161,7 @@ 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.320 &Syntax.DE.Doxygen.DataScript\ with\ doxygen :cal SetSyn("datascript.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>

View File

@ -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

16
runtime/syntax/bzl.vim Normal file
View File

@ -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

View File

@ -2,10 +2,10 @@
" Program: CMake - Cross-Platform Makefile Generator
" Module: $RCSfile: cmake-syntax.vim,v $
" Language: CMake
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Maintainer: Karthik Krishnan <karthik.krishnan@kitware.com>
" Last Change: 2012 Jun 01
" (Dominique Pelle added @Spell)
" Former Maintainer: Dimitri Merejkowsky <d.merej@gmail.com>
" Author: Andy Cedilnik <andy.cedilnik@kitware.com>
" Last Change: 2015 Sep 29
" Version: $Revision: 1.10 $
"
" Licence: The CMake license applies to this file. See
@ -31,9 +31,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,11 +44,11 @@ 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.

View File

@ -2,7 +2,7 @@
" Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
" Last Change: 2015 Mar 1
" Last Change: 2015 May 04
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@ -46,7 +46,7 @@ if !exists("cpp_no_cpp11")
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=cppRawDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
endif
" The minimum and maximum operators in GNU C++

View File

@ -1,11 +1,12 @@
" 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
@ -19,6 +20,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 +35,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 +65,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

View File

@ -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
@ -131,10 +131,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 +152,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 +167,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 +208,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\>"

View File

@ -1,8 +1,9 @@
" Vim syntax file
" Language: gnuplot 4.7.0
" Maintainer: Andrew Rasmussen andyras@users.sourceforge.net
" 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: 2014-02-24
" 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
@ -364,18 +365,18 @@ syn keyword gnuplotKeyword samples
" set size
syn keyword gnuplotKeyword size square nosquare ratio noratio
" set style
syn keyword gnuplotKeyword style function data noborder rectangle arrow
syn keyword gnuplotKeyword default nohead head heads size filled empty
syn keyword gnuplotKeyword nofilled front back boxplot range fraction
syn keyword gnuplotKeyword outliers nooutliers pointtype candlesticks
syn keyword gnuplotKeyword separation labels off auto x x2 sorted unsorted
syn keyword gnuplotKeyword fill empty transparent solid pattern border
syn keyword gnuplotKeyword increment userstyles financebars line default
syn keyword gnuplotKeyword linetype lt linecolor lc linewidth lw pointtype
syn keyword gnuplotKeyword pt pointsize ps pointinterval pi palette circle
syn keyword gnuplotKeyword radius graph screen wedge nowedge ellipse size
syn keyword gnuplotKeyword units xx xy yy histogram line textbox opaque
syn keyword gnuplotKeyword border noborder
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
@ -496,8 +497,8 @@ syn keyword gnuplotTodo contained TODO FIXME XXX
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 system test undefine unset
syn keyword gnuplotStatement update
syn keyword gnuplotStatement shell splot spstats stats system test undefine
syn keyword gnuplotStatement unset update
" ---- Define the default highlighting ---- "
" For version 5.7 and earlier: only when not done already

View File

@ -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.14
" URL: http://www.vim.org/scripts/script.php?script_id=945
" Last Change: 2015 Apr 13
" Last Change: 2015 Apr 21
" THE ORIGINAL AUTHOR'S NOTES:
"

View File

@ -1,7 +1,7 @@
" Vim syntax file
" Language: Python
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
" Last Change: 2015 Jun 19
" Last Change: 2015 Sep 15
" Credits: Neil Schemenauer <nas@python.ca>
" Dmitry Vasiliev
"
@ -51,24 +51,26 @@ set cpo&vim
" 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 as assert break continue del exec global
@ -79,6 +81,7 @@ 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
@ -147,7 +150,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]\=\>"
@ -159,54 +163,58 @@ 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
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
@ -214,13 +222,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")
@ -267,6 +289,7 @@ if version >= 508 || !exists("did_python_syn_inits")
HiLink pythonOperator Operator
HiLink pythonException Exception
HiLink pythonInclude Include
HiLink pythonAsync Statement
HiLink pythonDecorator Define
HiLink pythonFunction Function
HiLink pythonComment Comment

View File

@ -2,7 +2,7 @@
" Language: reStructuredText documentation format
" Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2014-10-03
" Latest Revision: 2015-09-07
if exists("b:current_syntax")
finish
@ -81,7 +81,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'

View File

@ -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

View File

@ -2,8 +2,8 @@
" Language: shell (sh) Korn shell (ksh) bash (sh)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
" Last Change: May 29, 2015
" Version: 137
" Last Change: Oct 09, 2015
" Version: 139
" 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 ?ric Brunet (eric.brunet@ens.fr)
@ -16,14 +16,14 @@ elseif 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
" AFAICT "." should be considered part of the iskeyword for ksh. Using iskeywords
" in syntax is dicey, so the following code permits the user to prevent/override
" 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
" g:sh_noisk does not exist : (default) append "." to iskeyword for kornshell
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
elseif !exists("g:sh_noisk") && exists("b:is_kornshell") " append '.' to iskeyword
setl isk+=.
endif
@ -128,7 +128,7 @@ syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDere
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr
syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
syn cluster shTestList contains=shCharClass,shCommandSub,shComment,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
" Echo: {{{1
" ====
" This one is needed INSIDE a CommandSub, so that `echo bla` be correct
@ -321,12 +321,11 @@ elseif !exists("g:sh_no_error")
endif
syn region shSingleQuote matchgroup=shQuote start=+'+ end=+'+ contains=@Spell
syn region shDoubleQuote matchgroup=shQuote start=+\%(\%(\\\\\)*\\\)\@<!"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
syn region shDoubleQuote matchgroup=shQuote start=+"+ skip=+\\"+ end=+"+ contains=@shDblQuoteList,shStringSpecial,@Spell
syn match shStringSpecial "[^[:print:] \t]" contained
syn match shStringSpecial "\%(\\\\\)*\\[\\"'`$()#]"
" COMBAK: why is ,shComment on next line???
syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial,shComment
syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shComment
syn match shSpecial "[^\\]\zs\%(\\\\\)*\\[\\"'`$()#]"
syn match shSpecial "^\%(\\\\\)*\\[\\"'`$()#]"
syn match shMoreSpecial "\%(\\\\\)*\\[\\"'`$()#]" nextgroup=shMoreSpecial contained
" Comments: {{{1
@ -409,27 +408,27 @@ 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
syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
syn region shFunctionFour fold matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
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="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
syn region shFunctionFour fold matchgroup=shFunction start="\<[^d][^o]\&\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
syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList
syn region shFunctionFour matchgroup=shFunction start="\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained
syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList
syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained
syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList
syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained
endif
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
syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
syn region shFunctionFour fold matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
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="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
syn region shFunctionThree fold matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
syn region shFunctionFour fold matchgroup=shFunction start="\<[^d][^o]\&\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
syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList
syn region shFunctionFour matchgroup=shFunction start="\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained
syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList
syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained
syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList
syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained
endif
endif

View File

@ -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

View File

@ -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

139
runtime/syntax/teraterm.vim Normal file
View File

@ -0,0 +1,139 @@
" Vim syntax file
" Language: Tera Term Language (TTL)
" Based on Tera Term Version 4.86
" Maintainer: Ken Takata
" URL: https://github.com/k-takata/vim-teraterm
" Last Change: 2015 Jun 24
" 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 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

View File

@ -223,7 +223,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

View File

@ -3,7 +3,7 @@
" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
" Previous Maintainer: Czo <Olivier.Sirol@lip6.fr>
" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
" Last Changed: 2015 Apr 25 by Daniel Kho
" Last Changed: 2015 Oct 13 by Daniel Kho
" $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $
" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
@ -72,6 +72,7 @@ syn keyword vhdlType boolean_vector integer_vector real_vector time_vector
syn keyword vhdlType string severity_level
" Predefined standard ieee VHDL types
syn keyword vhdlType positive natural signed unsigned
syn keyword vhdlType unresolved_signed unresolved_unsigned u_signed u_unsigned
syn keyword vhdlType line text
syn keyword vhdlType std_logic std_logic_vector
syn keyword vhdlType std_ulogic std_ulogic_vector
@ -92,12 +93,12 @@ 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 "\'behaviour" " Non-standard VHDL
"syn match vhdlAttribute "\'structure" " Non-standard VHDL
syn match vhdlAttribute "\'simple_name"
syn match vhdlAttribute "\'instance_name"
syn match vhdlAttribute "\'path_name"
syn match vhdlAttribute "\'foreign"
syn match vhdlAttribute "\'foreign" " VHPI
" signal attribute
syn match vhdlAttribute "\'active"
syn match vhdlAttribute "\'delayed"
@ -112,10 +113,9 @@ 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 "\'subtype"
syn match vhdlAttribute "\'element"
syn match vhdlAttribute "\'leftof"
syn match vhdlAttribute "\'low"
syn match vhdlAttribute "\'pos"
syn match vhdlAttribute "\'pred"
syn match vhdlAttribute "\'rightof"
@ -150,34 +150,76 @@ 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
" TODO remove the following line. You can't have a sequence of */=+ as an operator for example.
"syn match vhdlOperator "[&><=:+\-*\/|]"
" The following lines match valid and invalid operators.
" Concatenation and math operators
syn match vhdlOperator "&\|+\|-\|\*\|\/"
" Equality and comparison operators
syn match vhdlOperator "=\|\/=\|>\|<\|>="
" Assignment operators
syn match vhdlOperator "<=\|:="
syn match vhdlOperator "=>"
" VHDL-2008 conversion, matching equality/non-equality operators
syn match vhdlOperator "??\|?=\|?\/=\|?<\|?<=\|?>\|?>="
" Linting for illegal operators
" '='
syn match vhdlError "\(=\)[<=&+\-\*\/\\]\+"
syn match vhdlError "[=&+\-\*\\]\+\(=\)"
" '>', '<'
syn match vhdlError "\(>\)[<>&+\-\/\\]\+"
syn match vhdlError "[>&+\-\/\\]\+\(>\)"
syn match vhdlError "\(<\)[<&+\-\/\\]\+"
syn match vhdlError "[<>=&+\-\/\\]\+\(<\)"
" Covers most operators
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 case match
syn keyword vhdlTodo contained TODO NOTE
syn keyword vhdlFixme contained FIXME
syn case ignore
" Regex for space is '\s'
" Any number of spaces: \s*
" At least one space: \s+
syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell
syn match vhdlComment "--.*" contains=vhdlTodo,vhdlFixme,@Spell
syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell
syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell
" Industry-standard directives. These are not standard VHDL, but are commonly
" used in the industry.
syn match vhdlPreProc "/\* synthesis .* \*/"
"syn match vhdlPreProc "/\* simulation .* \*/"
syn match vhdlPreProc "/\* pragma .* \*/"
syn match vhdlPreProc "/\* synopsys .* \*/"
syn match vhdlPreProc "--\s*synthesis .*"
"syn match vhdlPreProc "--\s*simulation .*"
syn match vhdlPreProc "--\s*pragma .*"
syn match vhdlPreProc "--\s*synopsys .*"
" syn match vhdlGlobal "[\'$#~!%@?\^\[\]{}\\]"
"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
@ -203,7 +245,7 @@ if version >= 508 || !exists("did_vhdl_syntax_inits")
HiLink vhdlTime Number
HiLink vhdlType Type
HiLink vhdlOperator Operator
" HiLink vhdlGlobal Error
HiLink vhdlError Error
HiLink vhdlAttribute Special
HiLink vhdlPreProc PreProc

View File

@ -39,6 +39,7 @@ local redraw_flags={
local list_flags={
comma='P_COMMA',
onecomma='P_ONECOMMA',
flags='P_FLAGLIST',
flagscomma='P_COMMA|P_FLAGLIST',
}

32
scripts/git-log-pretty-since.sh Executable file
View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Shows a log with changes grouped next to their merge-commit.
#
# Parameters:
# $1 "since" commit
# $2 "inverse match" regex pattern
set -e
set -u
set -o pipefail
__SINCE=$1
__INVMATCH=$2
is_merge_commit() {
git rev-parse $1 >/dev/null 2>&1 \
|| { echo "ERROR: invalid commit: $1"; exit 1; }
git log $1^2 >/dev/null 2>&1 && return 0 || return 1
}
for commit in $(git log --format='%H' --first-parent --since $__SINCE); do
if is_merge_commit ${commit} ; then
if [ -z "$__INVMATCH" ] || ! git log --oneline ${commit}^1..${commit}^2 \
| grep -E "$__INVMATCH" >/dev/null 2>&1 ; then
git log -1 --oneline ${commit}
git log --format=' %h %s' ${commit}^1..${commit}^2
fi
else
git log -1 --oneline ${commit}
fi
done

View File

@ -287,7 +287,7 @@ local feed, insert, source = helpers.feed, helpers.insert, helpers.source
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
describe('$test_name', function()
setup(clear)
before_each(clear)
it('is working', function()
@{[join "\n", map { /^$/ ? '' : ' ' . $_ } @{$test_body_lines}]}

View File

@ -1,5 +1,5 @@
lpeg = require('lpeg')
msgpack = require('MessagePack')
mpack = require('mpack')
-- lpeg grammar for building api metadata from a set of header files. It
-- ignores comments and preprocessor commands and parses a very small subset
@ -115,7 +115,7 @@ static const uint8_t msgpack_metadata[] = {
]])
-- serialize the API metadata using msgpack and embed into the resulting
-- binary for easy querying by clients
packed = msgpack.pack(functions)
packed = mpack.pack(functions)
for i = 1, #packed do
output:write(string.byte(packed, i)..', ')
if i % 10 == 0 then

63
scripts/release.sh Executable file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Performs steps to tag a release.
#
# Steps:
# Create the "release" commit:
# - CMakeLists.txt: Unset NVIM_VERSION_PRERELEASE
# - Tag the commit.
# Create the "version bump" commit:
# - CMakeLists.txt: Set NVIM_VERSION_PRERELEASE to "-dev"
#
# Manual steps:
# - CMakeLists.txt: Bump NVIM_VERSION_* as appropriate.
# - git push --follow-tags
set -e
set -u
set -o pipefail
cd "$(git rev-parse --show-toplevel)"
__LAST_TAG=$(git describe --abbrev=0)
[ -z "$__LAST_TAG" ] && { echo 'ERROR: no tag found'; exit 1; }
__VERSION_MAJOR=$(grep 'set(NVIM_VERSION_MAJOR' CMakeLists.txt\
|sed -r 's/.*NVIM_VERSION_MAJOR ([[:digit:]]).*/\1/')
__VERSION_MINOR=$(grep 'set(NVIM_VERSION_MINOR' CMakeLists.txt\
|sed -r 's/.*NVIM_VERSION_MINOR ([[:digit:]]).*/\1/')
__VERSION_PATCH=$(grep 'set(NVIM_VERSION_PATCH' CMakeLists.txt\
|sed -r 's/.*NVIM_VERSION_PATCH ([[:digit:]]).*/\1/')
__VERSION="${__VERSION_MAJOR}.${__VERSION_MINOR}.${__VERSION_PATCH}"
{ [ -z "$__VERSION_MAJOR" ] || [ -z "$__VERSION_MINOR" ] || [ -z "$__VERSION_PATCH" ]; } \
&& { echo "ERROR: version parse failed: '${__VERSION}'"; exit 1; }
__RELEASE_MSG="NVIM v${__VERSION}
Features:
Fixes:
Changes:
"
__BUMP_MSG="version bump"
echo "Most recent tag: ${__LAST_TAG}"
echo "Release version: ${__VERSION}"
sed -i -r 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
echo "Building changelog since ${__LAST_TAG}..."
__CHANGELOG="$(./scripts/git-log-pretty-since.sh $__LAST_TAG 'vim-patch:\S')"
git add CMakeLists.txt
git commit --edit -m "${__RELEASE_MSG} ${__CHANGELOG}"
git tag -a v${__VERSION} -m "NVIM v${__VERSION}"
sed -i -r 's/(NVIM_VERSION_PRERELEASE) ""/\1 "-dev"/' CMakeLists.txt
nvim -c '/NVIM_VERSION' -c 'echo "Update version numbers"' CMakeLists.txt
git add CMakeLists.txt
git commit -m "$__BUMP_MSG"
echo "
Next steps:
- Double-check NVIM_VERSION_* in CMakeLists.txt
- git push --follow-tags
- update website: index.html"

View File

@ -5,9 +5,12 @@ set -u
set -o pipefail
readonly NEOVIM_SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
readonly VIM_SOURCE_DIR_DEFAULT=${NEOVIM_SOURCE_DIR}/.vim-src
readonly VIM_SOURCE_DIR_DEFAULT="${NEOVIM_SOURCE_DIR}/.vim-src"
readonly VIM_SOURCE_DIR="${VIM_SOURCE_DIR:-${VIM_SOURCE_DIR_DEFAULT}}"
readonly BASENAME="$(basename "${0}")"
readonly BRANCH_PREFIX="vim-"
CREATED_FILES=()
usage() {
echo "Helper script for porting Vim patches. For more information, see"
@ -21,6 +24,7 @@ usage() {
echo " -p {vim-revision} Download and apply the Vim patch vim-revision."
echo " vim-revision can be a version number of the "
echo " format '7.4.xxx' or a Git commit hash."
echo " -s Submit a vim-patch pull request to Neovim."
echo " -r {pr-number} Review a vim-patch pull request to Neovim."
echo
echo "Set VIM_SOURCE_DIR to change where Vim's sources are stored."
@ -35,12 +39,33 @@ check_executable() {
fi
}
clean_files() {
if [[ ${#CREATED_FILES[@]} -eq 0 ]]; then
return
fi
echo
echo "Created files:"
local file
for file in ${CREATED_FILES[@]}; do
echo "${file}"
done
read -p "Delete these files (Y/n)? " -n 1 -r reply
echo
if [[ "${reply}" =~ ^[Yy]$ ]]; then
rm -- ${CREATED_FILES[@]}
else
echo "You can use 'git clean' to remove these files when you're done."
fi
}
get_vim_sources() {
check_executable git
if [[ ! -d ${VIM_SOURCE_DIR} ]]; then
echo "Cloning Vim sources into '${VIM_SOURCE_DIR}'."
git clone --depth=1000 https://github.com/vim/vim.git "${VIM_SOURCE_DIR}"
git clone https://github.com/vim/vim.git "${VIM_SOURCE_DIR}"
cd "${VIM_SOURCE_DIR}"
else
if [[ ! -d "${VIM_SOURCE_DIR}/.git" ]]; then
@ -61,27 +86,36 @@ commit_message() {
"${vim_message}" "${vim_commit_url}"
}
find_git_remote() {
git remote -v \
| awk '$2 ~ /github.com[:/]neovim\/neovim/ && $3 == "(fetch)" {print $1}'
}
assign_commit_details() {
if [[ ${1} =~ [0-9]\.[0-9]\.[0-9]{3,4} ]]; then
# Interpret parameter as version number (tag).
vim_version="${1}"
vim_tag="v${1}"
vim_commit=$( cd "${VIM_SOURCE_DIR}" \
&& git log -1 --format="%H" ${vim_tag} )
vim_commit=$(cd "${VIM_SOURCE_DIR}" \
&& git log -1 --format="%H" ${vim_tag})
local strip_commit_line=true
else
# Interpret parameter as commit hash.
vim_version="${1:0:7}"
vim_commit="${1}"
vim_commit=$(cd "${VIM_SOURCE_DIR}" \
&& git log -1 --format="%H" ${vim_version})
local strip_commit_line=false
fi
vim_commit_url="https://github.com/vim/vim/commit/${vim_commit}"
vim_message="$(git log -1 --pretty='format:%B' "${vim_commit}")"
vim_message="$(cd "${VIM_SOURCE_DIR}" \
&& git log -1 --pretty='format:%B' "${vim_commit}" \
| sed -e 's/\(#[0-9]*\)/vim\/vim\1/g')"
if [[ ${strip_commit_line} == "true" ]]; then
# Remove first line of commit message.
vim_message="$(echo "${vim_message}" | sed -e '1d')"
fi
patch_file="vim-${vim_version}.patch"
}
get_vim_patch() {
@ -96,66 +130,111 @@ get_vim_patch() {
echo
echo "✔ Found Vim revision '${vim_commit}'."
# Collect patch details and store into variables.
vim_full="$(git show -1 --pretty=medium "${vim_commit}")"
# Patch surgery: preprocess the patch.
# - transform src/ paths to src/nvim/
vim_diff="$(git show -1 "${vim_commit}" \
local vim_full="$(git show -1 --pretty=medium "${vim_commit}" \
| LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g')"
neovim_message="$(commit_message)"
neovim_pr="
\`\`\`
${vim_message}
\`\`\`
local neovim_branch="${BRANCH_PREFIX}${vim_version}"
${vim_commit_url}
Original patch:
\`\`\`diff
${vim_diff}
\`\`\`"
neovim_branch="vim-${vim_version}"
echo
echo "Creating Git branch."
cd "${NEOVIM_SOURCE_DIR}"
output="$(git checkout -b "${neovim_branch}" 2>&1)" &&
echo "${output}" ||
(echo "${output}"; false)
local git_remote=$(find_git_remote)
local checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${checked_out_branch}" == ${BRANCH_PREFIX}* ]]; then
echo "✔ Current branch '${checked_out_branch}' seems to be a vim-patch"
echo " branch; not creating a new branch."
else
echo
echo "Fetching '${git_remote}/master'."
output="$(git fetch "${git_remote}" master 2>&1)" &&
echo "${output}" ||
(echo "${output}"; false)
echo
echo "Creating new branch '${neovim_branch}' based on '${git_remote}/master'."
cd "${NEOVIM_SOURCE_DIR}"
output="$(git checkout -b "${neovim_branch}" "${git_remote}/master" 2>&1)" &&
echo "${output}" ||
(echo "${output}"; false)
fi
echo
echo "Creating empty commit with correct commit message."
output="$(git commit --allow-empty --file 2>&1 - <<< "${neovim_message}")" &&
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
echo "${output}" ||
(echo "${output}"; false)
echo
echo "Creating files."
echo "${vim_diff}" > "${NEOVIM_SOURCE_DIR}/${neovim_branch}.diff"
echo "✔ Saved diff to '${NEOVIM_SOURCE_DIR}/${neovim_branch}.diff'."
echo "${vim_full}" > "${NEOVIM_SOURCE_DIR}/${neovim_branch}.patch"
echo "✔ Saved full commit details to '${NEOVIM_SOURCE_DIR}/${neovim_branch}.patch'."
echo "${neovim_pr}" > "${NEOVIM_SOURCE_DIR}/${neovim_branch}.pr"
echo "✔ Saved suggested PR description to '${NEOVIM_SOURCE_DIR}/${neovim_branch}.pr'."
echo "You can use 'git clean' to remove these files when you're done."
echo "${vim_full}" > "${NEOVIM_SOURCE_DIR}/${patch_file}"
echo "✔ Saved full commit details to '${NEOVIM_SOURCE_DIR}/${patch_file}'."
echo
echo "Instructions:"
echo
echo " Proceed to port the patch."
echo " You might want to try 'patch -p1 < ${neovim_branch}.diff' first."
echo " You might want to try 'patch -p1 < ${patch_file}' first."
echo
echo " If the patch contains a new test, consider porting it to Lua."
echo " You might want to try 'scripts/legacy2luatest.pl'."
echo
echo " Stage your changes ('git add ...') and use 'git commit --amend' to commit."
echo
echo " Push your changes with 'git push origin ${neovim_branch}' and create a"
echo " pull request called '[RFC] vim-patch:${vim_version}'. You might want "
echo " to use the text in '${neovim_branch}.pr' as the description of this pull request."
echo " To port additional patches related to ${vim_version} and add them to the current"
echo " branch, call '${BASENAME} -p' again. Please use this only if it wouldn't make"
echo " sense to send in each patch individually, as it will increase the size of the"
echo " pull request and make it harder to review."
echo
echo " When you are finished, use '${BASENAME} -s' to submit a pull request."
echo
echo " See https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim"
echo " for more information."
}
submit_pr() {
check_executable git
check_executable hub
cd "${NEOVIM_SOURCE_DIR}"
local checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
if [[ "${checked_out_branch}" != ${BRANCH_PREFIX}* ]]; then
echo "✘ Current branch '${checked_out_branch}' doesn't seem to be a vim-patch branch."
exit 1
fi
local git_remote=$(find_git_remote)
local pr_body="$(git log --reverse --format='#### %s%n%n%b%n' ${git_remote}/master..HEAD)"
local patches=("$(git log --reverse --format='%s' ${git_remote}/master..HEAD)")
patches=(${patches[@]//vim-patch:}) # Remove 'vim-patch:' prefix for each item in array.
local pr_title="${patches[@]}" # Create space-separated string from array.
pr_title="${pr_title// /,}" # Replace spaces with commas.
local pr_message="$(printf '[RFC] vim-patch:%s\n\n%s\n' "${pr_title#,}" "${pr_body}")"
echo "Pushing to 'origin/${checked_out_branch}'."
output="$(git push origin "${checked_out_branch}" 2>&1)" &&
echo "${output}" ||
(echo "${output}"; git reset --soft HEAD^1; false)
echo
echo "Creating pull request."
output="$(hub pull-request -F - 2>&1 <<< "${pr_message}")" &&
echo "${output}" ||
(echo "${output}"; false)
echo
echo "Cleaning up files."
local patch_file
for patch_file in ${patches[@]}; do
patch_file="vim-${patch_file}.patch"
if [[ ! -f "${NEOVIM_SOURCE_DIR}/${patch_file}" ]]; then
continue
fi
rm -- "${NEOVIM_SOURCE_DIR}/${patch_file}"
echo "✔ Removed '${NEOVIM_SOURCE_DIR}/${patch_file}'."
done
}
list_vim_patches() {
get_vim_sources
@ -172,7 +251,7 @@ list_vim_patches() {
local patch_number="${vim_tag:5}" # Remove prefix like "v7.4."
# Tagged Vim patch, check version.c:
is_missing="$(sed -n '/static int included_patches/,/}/p' "${NEOVIM_SOURCE_DIR}/src/nvim/version.c" |
grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")"
grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")"
vim_commit="${vim_tag#v}"
else
# Untagged Vim patch (e.g. runtime updates), check the Neovim git log:
@ -189,7 +268,8 @@ list_vim_patches() {
echo "Instructions:"
echo
echo " To port one of the above patches to Neovim, execute"
echo " this script with the patch revision as argument."
echo " this script with the patch revision as argument and"
echo " follow the instructions."
echo
echo " Examples: '${BASENAME} -p 7.4.487'"
echo " '${BASENAME} -p 1e8ebf870720e7b671f98f22d653009826304c4f'"
@ -198,32 +278,28 @@ list_vim_patches() {
echo " Out-of-order patches increase the possibility of bugs."
}
review_pr() {
check_executable curl
check_executable nvim
get_vim_sources
local pr="${1}"
echo
echo "Downloading data for pull request #${pr}."
review_commit() {
local neovim_commit_url="${1}"
local neovim_patch_url="${neovim_commit_url}.patch"
local git_patch_prefix='Subject: \[PATCH\] '
local neovim_patch="$(curl -Ssf "https://patch-diff.githubusercontent.com/raw/neovim/neovim/pull/${pr}.patch")"
echo "${neovim_patch}" > a
local neovim_patch="$(curl -Ssf "${neovim_patch_url}")"
local vim_version="$(head -n 4 <<< "${neovim_patch}" | sed -n "s/${git_patch_prefix}vim-patch:\([a-z0-9.]*\)$/\1/p")"
echo
if [[ -n "${vim_version}" ]]; then
echo "✔ Detected Vim patch '${vim_version}'."
else
echo "✘ Could not detect the Vim patch number."
echo " This script assumes that the PR contains a single commit"
echo " with 'vim-patch:XXX' as its title."
echo " This script assumes that the PR contains only commits"
echo " with 'vim-patch:XXX' in their title."
exit 1
fi
assign_commit_details "${vim_version}"
local vim_patch_url="${vim_commit_url}.patch"
local expected_commit_message="$(commit_message)"
local message_length="$(wc -l <<< "${expected_commit_message}")"
local commit_message="$(tail -n +4 <<< "${neovim_patch}" | head -n "${message_length}")"
@ -235,26 +311,57 @@ review_pr() {
echo "${expected_commit_message}"
echo " Actual:"
echo "${commit_message#${git_patch_prefix}}"
exit 1
fi
local base_name="vim-${vim_version}"
echo
echo "Creating files."
curl -Ssfo "${NEOVIM_SOURCE_DIR}/n${base_name}.diff" "https://patch-diff.githubusercontent.com/raw/neovim/neovim/pull/${pr}.diff"
echo "✔ Saved pull request diff to '${NEOVIM_SOURCE_DIR}/n${base_name}.diff'."
echo "${neovim_patch}" > "${NEOVIM_SOURCE_DIR}/n${base_name}.patch"
echo "✔ Saved full pull request commit details to '${NEOVIM_SOURCE_DIR}/n${base_name}.patch'."
git show "${vim_commit}" > "${NEOVIM_SOURCE_DIR}/${base_name}.diff"
echo "✔ Saved Vim diff to '${NEOVIM_SOURCE_DIR}/${base_name}.diff'."
echo "You can use 'git clean' to remove these files when you're done."
echo "${neovim_patch}" > "${NEOVIM_SOURCE_DIR}/n${patch_file}"
echo "✔ Saved pull request diff to '${NEOVIM_SOURCE_DIR}/n${patch_file}'."
CREATED_FILES+=("${NEOVIM_SOURCE_DIR}/n${patch_file}")
curl -Ssfo "${NEOVIM_SOURCE_DIR}/${patch_file}" "${vim_patch_url}"
echo "✔ Saved Vim diff to '${NEOVIM_SOURCE_DIR}/${patch_file}'."
CREATED_FILES+=("${NEOVIM_SOURCE_DIR}/${patch_file}")
echo
echo "Launching nvim."
exec nvim -O "${NEOVIM_SOURCE_DIR}/${base_name}.diff" "${NEOVIM_SOURCE_DIR}/n${base_name}.diff"
nvim -c "cd ${NEOVIM_SOURCE_DIR}" \
-O "${NEOVIM_SOURCE_DIR}/${patch_file}" "${NEOVIM_SOURCE_DIR}/n${patch_file}"
}
while getopts "hlp:r:" opt; do
review_pr() {
check_executable curl
check_executable nvim
check_executable jq
get_vim_sources
local pr="${1}"
echo
echo "Downloading data for pull request #${pr}."
local pr_commit_urls=($(curl -Ssf "https://api.github.com/repos/neovim/neovim/pulls/${pr}/commits" \
| jq -r '.[].html_url'))
echo "Found ${#pr_commit_urls[@]} commit(s)."
local pr_commit_url
local reply
for pr_commit_url in ${pr_commit_urls[@]}; do
review_commit "${pr_commit_url}"
if [[ "${pr_commit_url}" != "${pr_commit_urls[-1]}" ]]; then
read -p "Continue with next commit (Y/n)? " -n 1 -r reply
echo
if [[ ! "${reply}" =~ ^[Yy]$ ]]; then
break
fi
fi
done
clean_files
}
while getopts "hlp:r:s" opt; do
case ${opt} in
h)
usage
@ -272,6 +379,10 @@ while getopts "hlp:r:" opt; do
review_pr "${OPTARG}"
exit 0
;;
s)
submit_pr
exit 0
;;
*)
exit 1
;;

View File

@ -1,4 +1,4 @@
BasedOnStyle: llvm
BasedOnStyle: Google
Language: Cpp
ColumnLimit: 80
IndentWidth: 2
@ -10,3 +10,9 @@ AlignEscapedNewlinesLeft: false
AllowShortFunctionsOnASingleLine: false
SpacesBeforeTrailingComments: 2
PenaltyReturnTypeOnItsOwnLine: 200
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
BinPackParameters: false
BreakBeforeBinaryOperators: true
ContinuationIndentWidth: 4

View File

@ -41,25 +41,33 @@ include_directories(${GENERATED_DIR})
include_directories(${GENERATED_INCLUDES_DIR})
file(MAKE_DIRECTORY ${GENERATED_DIR})
file(MAKE_DIRECTORY ${GENERATED_DIR}/os)
file(MAKE_DIRECTORY ${GENERATED_DIR}/api)
file(MAKE_DIRECTORY ${GENERATED_DIR}/api/private)
file(MAKE_DIRECTORY ${GENERATED_DIR}/msgpack_rpc)
file(MAKE_DIRECTORY ${GENERATED_DIR}/tui)
file(MAKE_DIRECTORY ${GENERATED_DIR}/event)
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/os)
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/api)
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/api/private)
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/msgpack_rpc)
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/tui)
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/event)
file(GLOB NEOVIM_SOURCES *.c os/*.c api/*.c api/private/*.c msgpack_rpc/*.c
tui/*.c event/*.c)
file(GLOB NEOVIM_SOURCES *.c)
foreach(subdir
os
api
api/private
msgpack_rpc
tui
event
eval
)
file(MAKE_DIRECTORY ${GENERATED_DIR}/${subdir})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/${subdir})
file(GLOB sources ${subdir}/*.c)
list(APPEND NEOVIM_SOURCES ${sources})
endforeach()
file(GLOB_RECURSE NEOVIM_HEADERS *.h)
file(GLOB UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c)
# Sort file lists to ensure generated files are created in the same order from
# build to build.
list(SORT NEOVIM_SOURCES)
list(SORT NEOVIM_HEADERS)
foreach(sfile ${NEOVIM_SOURCES})
get_filename_component(f ${sfile} NAME)
if(${f} MATCHES "^(regexp_nfa.c)$")
@ -72,11 +80,9 @@ list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
# Handle legacy files that don't yet pass -Wconversion.
set(CONV_SOURCES
buffer.c
charset.c
diff.c
edit.c
eval.c
ex_cmds2.c
ex_cmds.c
ex_docmd.c
ex_getln.c
@ -85,10 +91,7 @@ set(CONV_SOURCES
mbyte.c
memline.c
message.c
misc1.c
ops.c
path.c
quickfix.c
regexp.c
screen.c
search.c

View File

@ -19,6 +19,7 @@
#include "nvim/mark.h"
#include "nvim/fileio.h"
#include "nvim/move.h"
#include "nvim/syntax.h"
#include "nvim/window.h"
#include "nvim/undo.h"
@ -44,14 +45,22 @@ Integer buffer_line_count(Buffer buffer, Error *err)
/// Gets a buffer line
///
/// @deprecated use buffer_get_lines instead.
/// for positive indices (including 0) use
/// "buffer_get_lines(buffer, index, index+1, true)"
/// for negative indices use
/// "buffer_get_lines(buffer, index-1, index, true)"
///
/// @param buffer The buffer handle
/// @param index The line index
/// @param[out] err Details of an error that may have occurred
/// @return The line string
String buffer_get_line(Buffer buffer, Integer index, Error *err)
{
String rv = {.size = 0};
Array slice = buffer_get_line_slice(buffer, index, index, true, true, err);
String rv = { .size = 0 };
index = convert_index(index);
Array slice = buffer_get_lines(buffer, index, index+1, true, err);
if (!err->set && slice.size) {
rv = slice.items[0].data.string;
@ -64,6 +73,12 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
/// Sets a buffer line
///
/// @deprecated use buffer_set_lines instead.
/// for positive indices use
/// "buffer_set_lines(buffer, index, index+1, true, [line])"
/// for negative indices use
/// "buffer_set_lines(buffer, index-1, index, true, [line])"
///
/// @param buffer The buffer handle
/// @param index The line index
/// @param line The new line.
@ -71,23 +86,34 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
void buffer_set_line(Buffer buffer, Integer index, String line, Error *err)
{
Object l = STRING_OBJ(line);
Array array = {.items = &l, .size = 1};
buffer_set_line_slice(buffer, index, index, true, true, array, err);
Array array = { .items = &l, .size = 1 };
index = convert_index(index);
buffer_set_lines(buffer, index, index+1, true, array, err);
}
/// Deletes a buffer line
///
/// @deprecated use buffer_set_lines instead.
/// for positive indices use
/// "buffer_set_lines(buffer, index, index+1, true, [])"
/// for negative indices use
/// "buffer_set_lines(buffer, index-1, index, true, [])"
/// @param buffer The buffer handle
/// @param index The line index
/// @param[out] err Details of an error that may have occurred
void buffer_del_line(Buffer buffer, Integer index, Error *err)
{
Array array = ARRAY_DICT_INIT;
buffer_set_line_slice(buffer, index, index, true, true, array, err);
index = convert_index(index);
buffer_set_lines(buffer, index, index+1, true, array, err);
}
/// Retrieves a line range from the buffer
///
/// @deprecated use buffer_get_lines(buffer, newstart, newend, false)
/// where newstart = start + int(not include_start) - int(start < 0)
/// newend = end + int(include_end) - int(end < 0)
/// int(bool) = 1 if bool is true else 0
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index
@ -101,17 +127,49 @@ ArrayOf(String) buffer_get_line_slice(Buffer buffer,
Boolean include_start,
Boolean include_end,
Error *err)
{
start = convert_index(start) + !include_start;
end = convert_index(end) + include_end;
return buffer_get_lines(buffer, start , end, false, err);
}
/// Retrieves a line range from the buffer
///
/// Indexing is zero-based, end-exclusive. Negative indices are interpreted
/// as length+1+index, i e -1 refers to the index past the end. So to get the
/// last element set start=-2 and end=-1.
///
/// Out-of-bounds indices are clamped to the nearest valid value, unless
/// `strict_indexing` is set.
///
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index (exclusive)
/// @param strict_indexing whether out-of-bounds should be an error.
/// @param[out] err Details of an error that may have occurred
/// @return An array of lines
ArrayOf(String) buffer_get_lines(Buffer buffer,
Integer start,
Integer end,
Boolean strict_indexing,
Error *err)
{
Array rv = ARRAY_DICT_INIT;
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf || !inbounds(buf, start)) {
if (!buf) {
return rv;
}
start = normalize_index(buf, start) + (include_start ? 0 : 1);
include_end = include_end || (end >= buf->b_ml.ml_line_count);
end = normalize_index(buf, end) + (include_end ? 1 : 0);
bool oob = false;
start = normalize_index(buf, start, &oob);
end = normalize_index(buf, end, &oob);
if (strict_indexing && oob) {
api_set_error(err, Validation, _("Index out of bounds"));
return rv;
}
if (start >= end) {
// Return 0-length array
@ -151,8 +209,14 @@ end:
return rv;
}
/// Replaces a line range on the buffer
///
/// @deprecated use buffer_set_lines(buffer, newstart, newend, false, lines)
/// where newstart = start + int(not include_start) + int(start < 0)
/// newend = end + int(include_end) + int(end < 0)
/// int(bool) = 1 if bool is true else 0
///
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index
@ -168,6 +232,37 @@ void buffer_set_line_slice(Buffer buffer,
Boolean include_end,
ArrayOf(String) replacement,
Error *err)
{
start = convert_index(start) + !include_start;
end = convert_index(end) + include_end;
buffer_set_lines(buffer, start, end, false, replacement, err);
}
/// Replaces line range on the buffer
///
/// Indexing is zero-based, end-exclusive. Negative indices are interpreted
/// as length+1+index, i e -1 refers to the index past the end. So to change
/// or delete the last element set start=-2 and end=-1.
///
/// To insert lines at a given index, set both start and end to the same index.
/// To delete a range of lines, set replacement to an empty array.
///
/// Out-of-bounds indices are clamped to the nearest valid value, unless
/// `strict_indexing` is set.
///
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index (exclusive)
/// @param strict_indexing whether out-of-bounds should be an error.
/// @param replacement An array of lines to use as replacement
/// @param[out] err Details of an error that may have occurred
void buffer_set_lines(Buffer buffer,
Integer start,
Integer end,
Boolean strict_indexing,
ArrayOf(String) replacement,
Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@ -175,14 +270,15 @@ void buffer_set_line_slice(Buffer buffer,
return;
}
if (!inbounds(buf, start)) {
bool oob = false;
start = normalize_index(buf, start, &oob);
end = normalize_index(buf, end, &oob);
if (strict_indexing && oob) {
api_set_error(err, Validation, _("Index out of bounds"));
return;
}
start = normalize_index(buf, start) + (include_start ? 0 : 1);
include_end = include_end || (end >= buf->b_ml.ml_line_count);
end = normalize_index(buf, end) + (include_end ? 1 : 0);
if (start > end) {
api_set_error(err,
@ -327,13 +423,16 @@ Object buffer_get_var(Buffer buffer, String name, Error *err)
return dict_get_value(buf->b_vars, name, err);
}
/// Sets a buffer-scoped (b:) variable. 'nil' value deletes the variable.
/// Sets a buffer-scoped (b:) variable
///
/// @param buffer The buffer handle
/// @param name The variable name
/// @param value The variable value
/// @param[out] err Details of an error that may have occurred
/// @return The old value
/// @return The old value or nil if there was no previous value.
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
Object buffer_set_var(Buffer buffer, String name, Object value, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@ -342,7 +441,27 @@ Object buffer_set_var(Buffer buffer, String name, Object value, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(buf->b_vars, name, value, err);
return dict_set_value(buf->b_vars, name, value, false, err);
}
/// Removes a buffer-scoped (b:) variable
///
/// @param buffer The buffer handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
Object buffer_del_var(Buffer buffer, String name, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
return (Object) OBJECT_INIT;
}
return dict_set_value(buf->b_vars, name, NIL, true, err);
}
/// Gets a buffer option value
@ -456,6 +575,8 @@ Boolean buffer_is_valid(Buffer buffer)
/// Inserts a sequence of lines to a buffer at a certain index
///
/// @deprecated use buffer_set_lines(buffer, lnum, lnum, true, lines)
///
/// @param buffer The buffer handle
/// @param lnum Insert the lines after `lnum`. If negative, it will append
/// to the end of the buffer.
@ -466,8 +587,9 @@ void buffer_insert(Buffer buffer,
ArrayOf(String) lines,
Error *err)
{
bool end_start = lnum < 0;
buffer_set_line_slice(buffer, lnum, lnum, !end_start, end_start, lines, err);
// "lnum" will be the index of the line after inserting,
// no matter if it is negative or not
buffer_set_lines(buffer, lnum, lnum, true, lines, err);
}
/// Return a tuple (row,col) representing the position of the named mark
@ -514,6 +636,99 @@ ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
return rv;
}
/// Adds a highlight to buffer.
///
/// This can be used for plugins which dynamically generate highlights to a
/// buffer (like a semantic highlighter or linter). The function adds a single
/// highlight to a buffer. Unlike matchaddpos() highlights follow changes to
/// line numbering (as lines are inserted/removed above the highlighted line),
/// like signs and marks do.
///
/// "src_id" is useful for batch deletion/updating of a set of highlights. When
/// called with src_id = 0, an unique source id is generated and returned.
/// Succesive calls can pass in it as "src_id" to add new highlights to the same
/// source group. All highlights in the same group can then be cleared with
/// buffer_clear_highlight. If the highlight never will be manually deleted
/// pass in -1 for "src_id".
///
/// If "hl_group" is the empty string no highlight is added, but a new src_id
/// is still returned. This is useful for an external plugin to synchrounously
/// request an unique src_id at initialization, and later asynchronously add and
/// clear highlights in response to buffer changes.
///
/// @param buffer The buffer handle
/// @param src_id Source group to use or 0 to use a new group,
/// or -1 for ungrouped highlight
/// @param hl_group Name of the highlight group to use
/// @param line The line to highlight
/// @param col_start Start of range of columns to highlight
/// @param col_end End of range of columns to highlight,
/// or -1 to highlight to end of line
/// @param[out] err Details of an error that may have occurred
/// @return The src_id that was used
Integer buffer_add_highlight(Buffer buffer,
Integer src_id,
String hl_group,
Integer line,
Integer col_start,
Integer col_end,
Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
return 0;
}
if (line < 0 || line >= MAXLNUM) {
api_set_error(err, Validation, _("Line number outside range"));
return 0;
}
if (col_start < 0 || col_start > MAXCOL) {
api_set_error(err, Validation, _("Column value outside range"));
return 0;
}
if (col_end < 0 || col_end > MAXCOL) {
col_end = MAXCOL;
}
int hlg_id = syn_name2id((char_u*)hl_group.data);
src_id = bufhl_add_hl(buf, (int)src_id, hlg_id, (linenr_T)line+1,
(colnr_T)col_start+1, (colnr_T)col_end);
return src_id;
}
/// Clears highlights from a given source group and a range of lines
///
/// To clear a source group in the entire buffer, pass in 1 and -1 to
/// line_start and line_end respectively.
///
/// @param buffer The buffer handle
/// @param src_id Highlight source group to clear, or -1 to clear all groups.
/// @param line_start Start of range of lines to clear
/// @param line_end End of range of lines to clear (exclusive)
/// or -1 to clear to end of file.
/// @param[out] err Details of an error that may have occurred
void buffer_clear_highlight(Buffer buffer,
Integer src_id,
Integer line_start,
Integer line_end,
Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
return;
}
if (line_start < 0 || line_start >= MAXLNUM) {
api_set_error(err, Validation, _("Line number outside range"));
return;
}
if (line_end < 0 || line_end > MAXLNUM) {
line_end = MAXLNUM;
}
bufhl_clear_line_range(buf, (int)src_id, (int)line_start+1, (int)line_end);
}
// Check if deleting lines made the cursor position invalid.
// Changed the lines from "lo" to "hi" and added "extra" lines (negative if
@ -538,20 +753,26 @@ static void fix_cursor(linenr_T lo, linenr_T hi, linenr_T extra)
}
// Normalizes 0-based indexes to buffer line numbers
static int64_t normalize_index(buf_T *buf, int64_t index)
static int64_t normalize_index(buf_T *buf, int64_t index, bool *oob)
{
int64_t line_count = buf->b_ml.ml_line_count;
// Fix if < 0
index = index < 0 ? buf->b_ml.ml_line_count + index : index;
index = index < 0 ? line_count + index +1 : index;
// Check for oob
if (index > line_count) {
*oob = true;
index = line_count;
} else if (index < 0) {
*oob = true;
index = 0;
}
// Convert the index to a vim line number
index++;
// Fix if > line_count
index = index > buf->b_ml.ml_line_count ? buf->b_ml.ml_line_count : index;
return index;
}
// Returns true if the 0-indexed `index` is within the 1-indexed buffer bounds.
static bool inbounds(buf_T *buf, int64_t index)
static int64_t convert_index(int64_t index)
{
linenr_T nlines = buf->b_ml.ml_line_count;
return index >= -nlines && index < nlines;
return index < 0 ? index - 1 : index;
}

View File

@ -99,4 +99,3 @@ struct key_value_pair {
#endif // NVIM_API_PRIVATE_DEFS_H

View File

@ -90,14 +90,17 @@ Object dict_get_value(dict_T *dict, String key, Error *err)
}
/// Set a value in a dict. Objects are recursively expanded into their
/// vimscript equivalents. Passing 'nil' as value deletes the key.
/// vimscript equivalents.
///
/// @param dict The vimscript dict
/// @param key The key
/// @param value The new value
/// @param del Delete key in place of setting it. Argument `value` is ignored in
/// this case.
/// @param[out] err Details of an error that may have occurred
/// @return the old value, if any
Object dict_set_value(dict_T *dict, String key, Object value, Error *err)
Object dict_set_value(dict_T *dict, String key, Object value, bool del,
Error *err)
{
Object rv = OBJECT_INIT;
@ -118,7 +121,7 @@ Object dict_set_value(dict_T *dict, String key, Object value, Error *err)
dictitem_T *di = dict_find(dict, (uint8_t *)key.data, (int)key.size);
if (value.type == kObjectTypeNil) {
if (del) {
// Delete the key
if (di == NULL) {
// Doesn't exist, fail
@ -397,13 +400,13 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
switch (obj.type) {
case kObjectTypeNil:
tv->v_type = VAR_NUMBER;
tv->vval.v_number = 0;
tv->v_type = VAR_SPECIAL;
tv->vval.v_special = kSpecialVarNull;
break;
case kObjectTypeBoolean:
tv->v_type = VAR_NUMBER;
tv->vval.v_number = obj.data.boolean;
tv->v_type = VAR_SPECIAL;
tv->vval.v_special = obj.data.boolean? kSpecialVarTrue: kSpecialVarFalse;
break;
case kObjectTypeBuffer:
@ -651,6 +654,21 @@ static Object vim_to_object_rec(typval_T *obj, PMap(ptr_t) *lookup)
}
switch (obj->v_type) {
case VAR_SPECIAL:
switch (obj->vval.v_special) {
case kSpecialVarTrue:
case kSpecialVarFalse: {
rv.type = kObjectTypeBoolean;
rv.data.boolean = (obj->vval.v_special == kSpecialVarTrue);
break;
}
case kSpecialVarNull: {
rv.type = kObjectTypeNil;
break;
}
}
break;
case VAR_STRING:
rv.type = kObjectTypeString;
rv.data.string = cstr_to_string((char *) obj->vval.v_string);
@ -730,6 +748,10 @@ static Object vim_to_object_rec(typval_T *obj, PMap(ptr_t) *lookup)
}
}
break;
case VAR_UNKNOWN:
case VAR_FUNC:
break;
}
return rv;

Some files were not shown because too many files have changed in this diff Show More