Compare commits

...

437 Commits

Author SHA1 Message Date
Justin M. Keyes
0542baac28 NVIM v0.1.7
FEATURES:
0213e99aaf PR #5561 'inccommand'

FIXES:
c685879eea PR #5632 SECURITY FIX
d28d108648 CheckHealth: Fix version comparison.
7be113d795 PR #5670 shell_write_cb: Schedule error message.
1d4563771b jobs: ensure calling jobclose() on a pty job sends SIGHUP.
36c0ec6dd4 tui/suspend_event(): set STDIN to "blocking"
7a4d069bcc, cf52b881d9 man.vim: avoid errors in unusual circumstances
ed198737fd PR #5546 ex_global: Catch CTRL-C even if it is mapped.

CHANGES:
9147331e21 PR #2905 encoding: only allow encoding=utf-8
5f0260808c PR #5636 build: Upgrade jemalloc
f1fed42ca7 PR #5567 l10n: Update Ukrainian translation
2016-11-27 20:03:30 +01:00
Justin M. Keyes
7be113d795 shell_write_cb: Schedule error message. (#5670)
Closes #5558
2016-11-26 13:08:42 +01:00
Björn Linse
ecd7beb6e4 Merge pull request #5666 from bfredl/modechangetest
ui: add tests for ui_mode_change
2016-11-25 17:39:46 +01:00
Justin M. Keyes
0de6f450e4 vim-patch:7.4.2086
Problem:    Using the system default encoding makes tests unpredictable.
Solution:   Always use utf-8 or latin1 in the new style tests.  Remove setting
            encoding and scriptencoding where it is not needed.

ac105ed3c4
2016-11-25 15:46:58 +01:00
Björn Linse
4b95bb582d ui: add tests for ui_mode_change
Also fix snapshot_util() to work even if default_attr_ids is not a
proper lua array.
2016-11-25 11:37:23 +01:00
James McCoy
42736d6a2a Merge pull request #5595 from jamessan/tsan-pie
tsan: Compile with -fPIE and updated clang
2016-11-24 09:55:12 -05:00
James McCoy
cbf2a86c1d Merge pull request #5654 from brcolow/vim-7.4.1923
vim-patch:7.4.1923
2016-11-23 21:27:20 -05:00
James McCoy
2c154216a4 Merge pull request #5644 from Shougo/vim-7.4.1691
vim-patch:7.4.1691
2016-11-23 21:03:26 -05:00
James McCoy
e00bc61325 Merge pull request #5642 from Shougo/vim-7.4.1660
vim-patch:7.4.1660
2016-11-23 20:49:24 -05:00
James McCoy
b1854cefea Merge pull request #5641 from Shougo/vim-7.4.1696
vim-patch:7.4.1696
2016-11-23 20:37:37 -05:00
James McCoy
ca292c9768 Avoid serializing NULL string through msgpack
Attempting to serialize a NULL string through msgpack results in
msgpack_sbuffer_write attempting to memcpy from a NULL pointer, which is
undefined behavior.
2016-11-23 20:30:00 -05:00
James McCoy
38ee85d000 Move utf8len_tab definition to globals.h
The existing code would cause utf8len_tab to be declared as non-extern
when main.cpp included globals.h as well as in mbyte.c.  This causes the
following warning

    Linking C executable ../../bin/nvim
    /usr/bin/ld: Warning: size of symbol `utf8len_tab' changed from 256 in CMakeFiles/nvim.dir/main.c.o to 320 in CMakeFiles/nvim.dir/mbyte.c.o

Moving the definition to globals.h and using INIT() ensures the array is
only defined in main.cpp and other places globals.h is included see an
extern declaration.
2016-11-23 20:29:59 -05:00
James McCoy
6d727657c8 ci: Make ubsan print out a stacktrace when it finds a problem 2016-11-23 20:29:59 -05:00
James McCoy
b6a090b4fd tsan: Compile with -fPIE and force clang-3.8
This fixes failures with TSAN builds like

    FATAL: ThreadSanitizer can not mmap the shadow memory (something is mapped at 0x55deea465000 < 0x7cf000000000)
    FATAL: Make sure to compile with -fPIE and to link with -pie.
2016-11-23 20:29:51 -05:00
Michael Ennen
4f8964cc00 vim-patch:7.4.1923
Problem:    Command line editing is not tested much.
Solution:   Add tests for expanding the file name and 'wildmenu'.

ae3150ec8d

The test_cmdline.vim tests were ported in 23f591dba0 and thus
should have marked 1923 as applied. The test_cmdline.vim invocation
has been moved from test_alot.vim to src/nvim/testdir/Makefile to
better accord with the upstream code.
2016-11-23 15:56:35 -07:00
Shougo Matsushita
5c06f350ce vim-patch:7.4.1691
Problem:    When switching to a new buffer and an autocommand applies syntax
            highlighting an ml_get error may occur.
Solution:   Check "syn_buf" against the buffer in the window. (Alexander von
            Buddenbrock, closes vim/vim#676)

b681be175b
2016-11-24 07:07:22 +09:00
Shougo Matsushita
81591b146a vim-patch:7.4.1696
Problem:    When using :stopinsert in a silent mapping the "INSERT" message
            isn't cleared. (Coacher)
Solution:   Always clear the message. (Christian Brabandt, closes vim/vim#718)

fd773e9e88
2016-11-24 07:04:39 +09:00
Michael Ennen
a46fc0d754 vim-patch:7.4.1928 (#5653)
Problem:    Overwriting pointer argument.
Solution:   Assign to what it points to. (Dominique Pelle)

76ae22fef3

The typos corrected in the original vim patch are no long present
in the neovim code base and the pointer assignment was done correctly
in the porting of patch 1913 (where the changes were introduced).
2016-11-23 22:00:11 +01:00
Shougo Matsushita
d152e2f3fd vim-patch:7.4.1660
Problem:    has('patch-7.4.1') doesn't work.
Solution:   Fix off-by-one error. (Thinca)

819821c5a9
2016-11-22 07:27:13 +09:00
Michael Ennen
5f0260808c build: Upgrade jemalloc from 4.2.1 to 4.3.1. (#5636)
Closes #5415
2016-11-21 13:36:55 +01:00
James McCoy
6b1c8bbc18 Merge pull request #5632 from jamessan/vim-8.0.0056
vim-patch:8.0.0056,8.0.0057
2016-11-20 23:03:24 -05:00
James McCoy
c685879eea vim-patch:8.0.0057
Problem:    Tests fail without the 'keymap' features.
Solution:   Check for feature in test.

9376f5f482
2016-11-20 14:07:46 -05:00
James McCoy
4fad66fbe6 vim-patch:8.0.0056
Problem:    When setting 'filetype' there is no check for a valid name.
Solution:   Only allow valid characters in 'filetype', 'syntax' and 'keymap'.

d0b5138ba4
2016-11-20 14:07:46 -05:00
Justin M. Keyes
42033bc5bd Merge #5630 from nhooyr/man-ftplugin
man.vim: bug fixes
2016-11-19 22:50:10 +01:00
Anmol Sethi
7a4d069bcc man.vim: do not assume ftplugin is sourced before syntax
Fixes #5574
2016-11-19 13:41:04 -05:00
Anmol Sethi
cf52b881d9 man.vim: no guarantee that the first line contains anything useful
Fixes #5628
2016-11-18 14:06:42 -05:00
Björn Linse
acbce46782 Merge pull request #5624 from bfredl/jobcloseterm
jobs: ensure calling jobclose() on a pty job sends SIGHUP
2016-11-17 18:40:59 +01:00
Justin M. Keyes
c3a7a94a12 l10n: Remove some non-UTF8 .po files. (#5622)
Some .po files do not have UTF8 versions, leave those alone for now.

Also remove sjiscorr.c utility.
2016-11-17 17:27:13 +01:00
Björn Linse
1d4563771b jobs: ensure calling jobclose() on a pty job sends SIGHUP. Closes #5619 2016-11-17 15:13:45 +01:00
James McCoy
927e3e32d7 Merge pull request #5623 from justinmk/luacheck
build: Target luacheck HEAD.
2016-11-16 21:17:21 -05:00
Justin M. Keyes
44e6ee930f build: Target luacheck HEAD.
https://github.com/mpeterv/luacheck/pull/81#issuecomment-261099606

> If you really want to use bleeding-edge version you should get the
> rockspec from master branch, not a fixed commit ...
> The correct way to install from a specific commit is cloning that
> commit and running "luarocks make" from project directory. The reason
> is that running "install" or "build" on an scm rockspec fetches
> sources from master but uses build description from the rockspec
> itself, which may be outdated.
2016-11-17 00:55:39 +01:00
Justin M. Keyes
5e241b5f50 build: cmake: Use portable delimiters. (#5620)
Fixes build on Windows (msys2 mingw64).
Closes #5342
2016-11-16 22:26:51 +01:00
Anatolii Sakhnik
f1fed42ca7 l10n: Update Ukrainian translation (#5567)
* Fix translation of the term 'tag'

Prefer native word instead of transliteration

* Update uk.po automatically

Run make update-po-uk in src/nvim/po

* Update fuzzy translations in uk.po

* Translate missing msgstr

* Fix layout of the front page

* Apply cleanup.vim

Additionally, remove irrelevant and confusing comments

* Copy uk.po into uk.cp1251.po
2016-11-16 18:58:07 +01:00
James McCoy
108d54bbd4 Merge pull request #5600 from jamessan/vim-7.4.1640
vim-patch:7.4.1640,7.4.1647,7.4.1650,7.4.1664
2016-11-16 06:52:19 -05:00
James McCoy
c66ca17ca1 Merge pull request #5614 from Shougo/vim-7.4.2251
vim-patch:7.4.2251
2016-11-15 23:45:20 -05:00
James McCoy
34317846d6 lint 2016-11-15 23:16:09 -05:00
James McCoy
4e66bc99e4 Mark 7.4.1697 as applied
The patch was merged in 9e1c6596 but version.c didn't get updated
accordingly.
2016-11-15 23:16:09 -05:00
James McCoy
2e5736e2cd vim-patch:7.4.1664
Problem:    Crash in :cgetexpr.
Solution:   Check for NULL pointer. (Dominique) Add a test.

89c64d557d
2016-11-15 23:16:09 -05:00
James McCoy
830bf8665b vim-patch:7.4.1650
Problem:    Quickfix test fails.
Solution:   Accept any number of matches.

f68f1d7079
2016-11-15 23:16:09 -05:00
James McCoy
caa33aaaf8 vim-patch:7.4.1647
Problem:    Using freed memory after setqflist() and ":caddbuffer".  (Dominique)
Solution:   Set qf_ptr when adding the first item to the quickfix list.

8b20179c65
2016-11-15 23:16:08 -05:00
James McCoy
c0fd830be4 Bump all nvim-specific error codes above E5000
In order to not conflict with new error codes that Vim adds, all Neovim
error codes should be above 5000.  The three existing sub-5000 error
codes (E926, E951, and E952) are now E50003, E5004, and E5005
respectively.

E953 was removed in 6167ce6df2, so just
remove it from the help.
2016-11-15 23:16:08 -05:00
James McCoy
7231438f12 vim-patch:7.4.1640
Problem:    Crash when an autocommand changes a quickfix list. (Dominique)
Solution:   Check wether an entry is still valid. (Yegappan Lakshmanan,
            Hirohito Higashi)

ffec3c5349
2016-11-15 23:16:08 -05:00
James McCoy
aba853a156 Merge pull request #5615 from jamessan/vim-7.4.1892
vim-patch:7.4.1892,7.4.1894
2016-11-15 22:49:34 -05:00
James McCoy
49f73e5275 vim-patch:7.4.1894
Problem:    Cannot get the window ID for a mouse click.
Solution:   Add v:mouse_winid.

511972d810
2016-11-15 22:00:25 -05:00
James McCoy
defa86b08a vim-patch:7.4.1892
Problem:    balloon eval only gets the window number, not the ID.
Solution:   Add v:beval_winid.

c9721bdc63
2016-11-15 21:48:08 -05:00
Shougo Matsushita
458b1fc0e7 vim-patch:7.4.2251
Problem:    In rare cases diffing 4 buffers is not enough.
Solution:   Raise the limit to 8. (closes vim/vim#1000)

015efc32c1
2016-11-16 08:55:17 +09:00
James McCoy
c91e9c1c7a Merge pull request #5611 from jamessan/vim-7.4.2174
vim-patch:7.4.2174
2016-11-15 14:57:57 -05:00
Shougo
c69cfd7d1c vim-patch:8.0.0035 (#5609)
Problem:    Order of matches for 'omnifunc' is messed up. (Danny Su)
Solution:   Do not set compl_curr_match when called from complete_check().
            (closes vim/vim#1168)

472e85970e
2016-11-15 17:59:55 +01:00
James McCoy
12ed735719 lint 2016-11-15 11:50:54 -05:00
James McCoy
9d9d93aee3 vim-patch:7.4.2174
Problem:    Adding duplicate flags to 'whichwrap' leaves commas behind.
Solution:   Also remove the commas. (Naruhiko Nishino)

c8ce615299
2016-11-15 11:48:37 -05:00
James McCoy
10c72cd365 vim-patch.sh: Remove "set -o pipefail"
grep 2.26 changed its behavior when redirecting its output to /dev/null
such that it exits as soon as one match is found.  This causes sed to
get a SIGPIPE which, due to "set -o pipefail", falsely implies that the
patch is not applied.

Removing "set -o pipefail" preserves the good exit status from grep.
2016-11-15 07:53:01 -05:00
Justin M. Keyes
d28d108648 CheckHealth: Fix version comparison.
Compare numbers instead of strings.
2016-11-15 13:15:40 +01:00
Justin M. Keyes
01ef6fc3d2 Merge #5607 from justinmk/icm
'inccommand': auto-disable if too slow; fix other behaviors
2016-11-15 09:12:47 +01:00
Justin M. Keyes
35231312d7 'inccommand': Add tests. 2016-11-15 05:01:25 +01:00
Justin M. Keyes
3f7a2d785d 'inccommand': Introduce CMDPREVIEW state.
Command "live preview" is fundamentally a non-recursive concept
("preview of a preview" is not useful). Maintaining this as a
global is less awkward and closer to what we actually want to
express, vs adorning exarg_T, CommandLineState, etc.
2016-11-15 04:22:24 +01:00
Justin M. Keyes
708617ebb6 inccommand=nosplit: Jump to first match.
Call update_topline() to adjust the current viewport.

Closes #5597
2016-11-15 04:22:24 +01:00
Justin M. Keyes
91507c271e 'inccommand': Detect "non-interactive", "too slow".
command_line_changed:
  - Check (current_SID == 0) instead of KeyTyped
    - We want to update during mappings (KeyTyped is false then).
  - Check vpeekc_any()
    - Avoids unnecessary work.
    - Avoids triggering live preview during macros.
    - Caveat: This makes the redraw "stutter" if user spams (holds a key)
      in the replace pattern. But that scenario is not important.
  - Update screen if the command is changed to a non-live command.
    (`s->live` goes from true => false) => clears the preview
command_line_execute:
  - Let CTRL-C cancel live preview
do_sub:
  - Enforce a time limit ('redrawtime').
  - Unset 'inccommand' if time limit is reached.

Closes #5602
Closes #5585
2016-11-15 04:22:24 +01:00
James McCoy
0c799a8f10 Merge pull request #5606 from jamessan/vim-7.4.1658
vim-patch:7.4.1658
2016-11-14 16:16:18 -05:00
James McCoy
0b686e9b61 lint 2016-11-14 14:16:40 -05:00
James McCoy
9d2985ecba vim-patch:7.4.1658
Problem:    A plugin does not know when VimEnter autocommands were already
            triggered.
Solution:   Add the v:vim_did_enter variable.

1473551a44
2016-11-14 14:16:40 -05:00
James McCoy
4539d867d4 Merge pull request #5603 from jamessan/remove-flaky-term-resize-test
test: window_spec: Remove flaky terminal resize test
2016-11-13 19:54:14 -05:00
James McCoy
5e1dc26f74 test: window_spec: Remove flaky terminal resize test 2016-11-13 18:47:03 -05:00
Justin M. Keyes
598f5af58b Merge #5582 from justinmk/icm
'inccommand': Support :smagic/:snomagic. Less jumping around.
2016-11-12 13:32:48 +01:00
Tommy Allen
84eed76b55 CheckHealth: Include v:throwpoint in error message (#5575)
* health.vim: Include v:throwpoint in error message

* health/provider.vim: Check for ruby executable

* health/provider.vim: Combine subprocess stdout and stderr

* test: Updated CheckHealth test
2016-11-12 11:59:15 +01:00
James McCoy
7e48c23a50 vim-patch:7.4.1634 (#5594)
Problem:    Vertical movement after CTRL-A ends up in the wrong column.
            (Urtica Dioica)
Solution:   Set curswant when appropriate. (Hirohito Higashi)

8e08125d3a
2016-11-12 11:32:23 +01:00
James McCoy
c5bc0ea04c vim-patch:7.4.1614 (#5593)
Problem:    Still quickfix test in old style.
Solution:   Turn test 10 into a new style test.

7eba3d2cbf
2016-11-12 11:30:18 +01:00
James McCoy
05d1211424 Merge pull request #5592 from jamessan/vim-7.4.1591
vim-patch:7.4.1591
2016-11-11 16:01:13 -05:00
James McCoy
7baa96b717 vim-patch:7.4.1591
Problem:    The quickfix title is truncated.
Solution:   Save the command before it is truncated. (Anton Lindqvist)

5584df65a0
2016-11-11 11:37:42 -05:00
Justin M. Keyes
ae9a3d3b99 'inccommand': Simplify cursor placement logic.
Remove the inner for-loop; just use the column of the first in-line
match.
2016-11-11 05:45:06 +01:00
Justin M. Keyes
795f2bb9b9 'inccommand': Restore cursor/view if cancelled.
Restore cursor position and window "view", if command is cancelled.
This is how 'incsearch' works.
2016-11-10 18:09:48 +01:00
Justin M. Keyes
2e1217da46 'inccommand': buftype=nofile, restore cursor/view
- Use a standard scratch buffer instead of a new 'buftype', functions
  like curbufIsChanged() already have special handling for scratch bufs.
- Cleanup some stuff from the previous merge.
- Add support for :smagic, :snomagic. Closes #5578
2016-11-10 15:48:00 +01:00
Justin M. Keyes
0213e99aaf Merge #5561 'inccommand'
Initial work by:
  Robin Elrharbi-Fleury (Robinhola)
  Audrey Rayé (Adrey06)
  Philémon Hullot (DesbyP)
  Aymeric Collange (aym7)
  Clément Guyomard (Clement0)

Major revisions by:
  KillTheMule
  Björn Linse <bjorn.linse@gmail.com>
  Justin M. Keyes <justinkz@gmail.com>
2016-11-09 03:19:22 +01:00
Justin M. Keyes
aa0e09d251 'inccommand': Preserve curbuf->b_u_newhead.
Add tests for undotree().

Helped-by: Björn Linse <bjorn.linse@gmail.com>

When "curhead" points to a valid head, the value of "newhead" is
meaningless (and really should be set to null). The undo state for
a buffer is _logically_ the enum:

  enum UndoState {
    CurrentHead(head),
    NewHead(head),
    EmptyTree
  }

nvim _represents_ this as: whenever `curbuf->b_u_curhead` is nonnull it
should be used as the current head, and `curbuf->b_u_newhead` is
ignored. If the there is a current head, then this will be redoed on the
next redo, and its parent will be undone on next undo. Only if
`b_u_curhead` is NULL, `b_u_newhead` will be used as the head to undo
(and it is not possible to redo). Also both can be NULL, to indicate an
empty undotree. (To be fair, this only strictly true when calling undo.c
from the outside, in some places _within_ a function in undo.c both
values might be meaningful)

Apparently `undotree()` breaks this non-abstraction, this _cosmetic_
issue can easily be fixed by `ex_substitute` also saving and restoring
`b_u_newhead`, but is doesn't reflect any error really how
`u_undo_and_forget` manipulates the _actual_ state of the undo tree.
2016-11-09 01:03:47 +01:00
Justin M. Keyes
21dfbfbb9a perf: do_sub(): avoid work, avoid screen updates
- Don't fill matched_lines if not showing a preview (!eap->is_live).
- Encapsulate: Move cursor placement logic to show_sub().
2016-11-08 21:22:24 +01:00
Justin M. Keyes
f3e8ca3bf5 'inccommand': preserve 'modified'
During the live preview, the buffer-local 'modified' flag
should not be changed.
2016-11-08 21:22:24 +01:00
Justin M. Keyes
ff6ec703d5 'inccommand': Do not trigger during scripts, feedkeys(). 2016-11-08 21:22:24 +01:00
KillTheMule
527ba2b12a 'inccommand': test: scripts/feedkeys() should not trigger preview 2016-11-08 21:22:24 +01:00
Justin M. Keyes
6a3f8d48d0 'inccommand': rename 'incsubstitute'
'inccommand' allows us to expand the feature to other commands, such as:
    :cdo
    :cfdo
    :global

Also rename "IncSubstitute" highlight group to "Substitute".
2016-11-08 21:22:13 +01:00
Justin M. Keyes
1e0e301062 'inccommand': format line numbers as "|123| "
This matches what Quickfix traditionally does.
2016-11-08 21:21:46 +01:00
Justin M. Keyes
3ccf69c1de 'inccommand': set buffer name to [Preview]
[inc_sub] is less obvious for users. Also, in the future we may want to
generalize the idea of a "preview buffer", or "incremental commands"
besides :substitute.
2016-11-08 21:21:46 +01:00
Justin M. Keyes
d0689eb0b2 'inccommand': disable 'cursorline', 'spell' in preview 2016-11-08 21:21:43 +01:00
Justin M. Keyes
e31f9007e4 'inccommand': preserve b:changedtick 2016-11-08 21:21:00 +01:00
Justin M. Keyes
e4e7b2d239 lint 2016-11-08 21:21:00 +01:00
Justin M. Keyes
c04ffe866d 'inccommand': rework
- Eliminate/isolate static/global variables
- Remove special-case parameter from buflist_new()
- Remove special-case ECMD_RESERVED_BUFNR
- To determine when u_undo_and_forget() should be done, check
  b_changedtick instead of a heuristic.
- use mb_string2cells() instead of strlen() to measure the :sub patterns
- call ml_close() before buf_clear_file(). Avoids leaks caught by ASan.

Original patch by:
  Robin Elrharbi-Fleury (Robinhola)
  Audrey Rayé (Adrey06)
  Philémon Hullot (DesbyP)
  Aymeric Collange (aym7)
  Clément Guyomard (Clement0)
2016-11-08 21:20:08 +01:00
Marco Hinz
bd33f1165b CheckHealth: ignore non-existing markdownCodeBlock group (#5570)
People using [1] would experience an error, because their markdown syntax
doesn't define the markdownCodeBlock group.

[1]: https://github.com/plasticboy/vim-markdown

Closes #5569
2016-11-08 19:01:15 +01:00
Tommy Allen
3089c86f4e CheckHealth: timeout system() calls (#5565) 2016-11-08 14:34:03 +01:00
Björn Linse
9147331e21 Merge pull request #2905 from bfredl/utf8
Only allow encoding=utf-8 and simplify multibyte code
2016-11-05 18:12:14 +01:00
Björn Linse
4ab3fe8eaa encoding: update documentation 2016-11-05 14:49:24 +01:00
Björn Linse
b3ece5c81c encoding: update tests
Change shada reencoding tests to check for
correct handling of UTF-8 and binary strings.

Delete enc=latin1 json tests.
2016-11-05 14:49:24 +01:00
Björn Linse
18f56c8e90 encoding: delete non-UTF-8 implementations of multibyte functions
Deleted documentation was duplicated at specific utf_ implementation
2016-11-05 14:49:24 +01:00
Björn Linse
5072ab9e5b encoding: cleanup mbyte.c given fixed encoding=utf-8
Eliminate mb_init():
Set "enc_utf" and "has_mbyte" early. Eliminate "enc_unicode" and "enc_latin1like".
init_chartab() and screenalloc() are already invoked elsewhere
in the initialization process.
The EncodingChanged autocmd cannot be triggered.
At initialization, there is no spellfiles to reload
2016-11-05 14:49:24 +01:00
Björn Linse
4804001aff encoding: only allow encoding=utf-8 2016-11-05 14:49:23 +01:00
Marco Hinz
32d9c19e29 Health: introduce help links (#5557)
We can now use help links like in normal help pages. The bars around them will
be concealed as well.

* Health: link string "SUCCESS" to ModeMsg

So far we linked "SUCCESS" to the Function highlight group.

The newly introduced healthHelp group links to Idenfifier as it does for links
in normal help pages.

Now the problem is that the Function group links again to Identifier as well, so
both, "SUCCESS" and help links, would use the same colors.

* Health: don't use Markdown code blocks

Every line indented by more than 4 spaces would lose its highlighting otherwise.

* Health: add helper health#help_to_link()
2016-11-04 11:03:05 +01:00
James McCoy
01f1028496 Merge pull request #5524 from brcolow/vim-7.4.1967
vim-patch:7.4.1967
2016-11-02 20:06:23 -04:00
Michael Ennen
b8bb1f6729 vim-patch:7.4.1967
Problem: Falling back from NFA to old regexp engine does not work properly.
(fritzophrenic)
Solution: Do not restore nfa_match. (Christian Brabandt, closes vim/vim#867)

6747fabc73

Helped-by: jamessan
2016-11-02 20:05:45 -04:00
James McCoy
9ef4be9aab Merge pull request #5550 from jamessan/big-endian-fixes
Making nvim big-endian friendly
2016-11-02 20:04:10 -04:00
James McCoy
654e92186b lint 2016-11-02 10:06:27 -04:00
James McCoy
9b545dd3db nvim_win_get_number: Use int as rv to fix BE issues
rv is int64_t but its address is being passed into win_get_tabwin as if
it were an int.  This breaks on big-endian systems, since win_get_tabwin
will store the data to the "wrong" half of the int64_t, thus returning
invalid data out of nvim_win_get_number.
2016-11-02 10:06:27 -04:00
James McCoy
37e64d79cc object_to_vim: Fix buffer/window/tabpage conversion on BE systems
Since data.integer is a different (larger) integer type than
data.{buffer,window,tabpage}, we cannot abuse the union by using
data.integer to access the value for all 4 types.  Instead, remove the
{buffer,window,tabpage} members and always use the integer member.

In order to accomodate this, perform distinct validation and coercion
between the Integer type and Buffer/Window/Tabpage types in
object_to_vim, msgpack_rpc helpers, and gendispatch.lua.
2016-11-02 10:06:27 -04:00
James McCoy
87ff2682d7 Use int as the standard type for boolean options.
All options are accessed by passing char_u pointers around, casting the
pointer to the right pointer type for the specific option, and then
dereferencing that pointer.

This dance works fine on little-endian systems when some bool options
are int types (as in Vim) and some are bool types (as would make more
sense), but on big-endian systems *(int *)varp when varp is pointing to
a bool will read random memory.

Therefore, all boolean options must remain a consistent type and int is
currently the easiest to choose.
2016-11-02 10:06:26 -04:00
Justin M. Keyes
349fa0048b Merge #5542 from mhinz/health/clipboard
CheckHealth: add clipboard check
2016-11-02 12:17:32 +01:00
Marco Hinz
3a802e3c16 provider/clipboard.vim: never show a warning on sourcing
Never throw an error when provider/clipboard.vim is sourced for the first time.
Save the error instead and expose it via `provider#clipboard#Error()`, mimicking
provider/python.vim.
2016-11-02 12:06:57 +01:00
Marco Hinz
797d72a997 health/provider.vim: add clipboard check 2016-11-02 12:06:54 +01:00
Marco Hinz
0a1b852cd1 provider/clipboard.vim: refactor 2016-11-02 12:04:43 +01:00
Justin M. Keyes
36c0ec6dd4 tui/suspend_event(): set STDIN to "blocking"
Set STDIN to blocking on "suspend". This was missed in #2598.
See 8a782f1699.

Also on "continue"/SIGCONT explicitly set STDIN back to NON-blocking.
We don't explicitly do that on *startup* (libuv does it internally),
but on "continue" it seems wise to restore libuv's expectations.

Closes #5459
2016-11-02 01:20:16 +01:00
James McCoy
d37c2e5dc2 doc: Remove features from vim_diff which have been merged upstream (#5554)
- TabNew/TabClosed: Introduced in 7.4.2075 and 7.4.2077
- hl-EndOfBuffer: Introduced in 7.4.2213
2016-10-31 17:26:32 +01:00
James McCoy
859e9fa65f Merge pull request #5527 from brcolow/vim-7.4.1730
vim-patch:7.4.[1730,1734,1741,1742,1779,1782]
2016-10-31 10:13:41 -04:00
Justin M. Keyes
ed198737fd Merge #5546 from justinmk/global-ctrlc
ex_global: Catch CTRL-C even if it is mapped.
2016-10-30 14:20:40 +01:00
Justin M. Keyes
49cf0b6ac4 lint 2016-10-30 13:10:29 +01:00
Justin M. Keyes
7cd204dbfa ex_global: Catch CTRL-C even if it is mapped.
Problem: If CTRL-C is mapped, it does not interrupt :global output.
Solution: clear `mapped_ctrl_c` during :global.
2016-10-30 13:10:29 +01:00
KillTheMule
e8c0f90962 Linted 2016-10-30 10:52:05 +01:00
KillTheMule
561c1e39e0 Tests for incsubstitution feature 2016-10-30 10:52:05 +01:00
KillTheMule
13841a56b4 Incsubsitution feature
Originally implemented by

* Clement0
* DesbyP
* aym7
* Adrey06
* Robinhola

in #4811. Major reworkings and bug
fixes by

* bfredl

Most tests suggested by ZyX-l, suggestions for improvements by oni-link.
2016-10-30 10:21:18 +01:00
James McCoy
6143cfdeec Merge pull request #5543 from jamessan/fix-shada-marks-test
test: Fix shada/marks_spec.lua failure
2016-10-29 12:49:50 -04:00
J Phani Mahesh
3d49fc1f50 CheckHealth: fix check for tmux escape-time (#5545) 2016-10-29 14:48:19 +02:00
James McCoy
93f3896300 test: Fix shada/marks_spec.lua failure
The 'dump and read back mark " from a closed tab' test needs to actually
create a second tab.  Since it wasn't doing so, the 'q!' command caused
nvim to exit and the subsequent 'qall' command fails.
2016-10-28 22:32:14 -04:00
Justin M. Keyes
242c3d5f0b version bump 2016-10-28 15:16:59 +02:00
Justin M. Keyes
cc1ec959f1 NVIM v0.1.6
FEATURES:
0b5a7e4ad5 #4432 API: external UIs can render custom popupmenu
c6ac4f84b1 #4934 API: call any API method from vimscript
31df051ed9 #4568 API: nvim_call_atomic(): multiple calls in a single request
b268ba353a #5424 API: nvim_win_get_number(), nvim_tabpage_get_number()
e7e2844d46 has("nvim-1.2.3") checks for a specific Nvim version
522b885a0d #5295, #5493 `:CheckHealth` checks tmux, terminfo, performance
719dae2e01 #5384 events: allow event processing in getchar()
f25797f869 #5386 API: metadata: Nvim version & API level
22dfe6925d #5389 API: metadata: "since", "deprecated_since"
605e74327a Added QuickFixLine highlight group

CHANGES:
4af6ec746c #5253 perf: Disable clipboard in do_cmdline()
6e9f329d05 #5299 perf: Skip foldUpdate() in insert-mode.
9d4fcec7c6 #5426 perf: Do not auto-update folds for some foldmethods.
eeec0cab58 #5419 tui: Default to normal-mode cursor shape.

FIXES:
e83845285c #5436 tui: Fix "weird characters" / "bleeding termcodes"
10a54ad12e #5243 signal_init: Always unblock SIGCHLD.
bccb49bedb #5316 eval.c: Fix memory leak for detached pty job
626065d385 #5227 tchdir: New tab should inherit CWD.
cd321b7d0f #5292 getcwd(): Return empty string if CWD is invalid.
6127eaef05 shada: Fix non-writeable ShaDa directory handling
ca65514a24 #2789 system(): Respect shellxescape, shellxquote
2daf54ee8d #4874 Restore vim-like tab dragging
0c536b5d8a #5319 syntax.c: Support bg/fg special color-names.
3c53371b0c #4972 from justinmk/schedule-ui_refresh
68bcb32ec4 #4789 tui.c: Do not wait for tui loop on teardown.
c8b6ec2e6a #5409 v:count broken in command-line window
6bc3bcefc6 #5461 fix emoji display
51937e1322 #5470 fix :terminal with :argadd, :argu
79d77da8a0 #5481 external UIs: opening multiple files from command-line
657ba62a84 #5501 rplugin: resolve paths in manifest file
6a6f188d2a #5502 system('foo &', 'bar'): Show error, don't crash.
1ff162c0d9 #5515 os_nodetype: open fd with O_NONBLOCK
2a6c5bb0c4 #5450 modeline: Handle version number overflow.
0ade1bb706 #5225 CI tests now run against Windows!
2016-10-28 15:16:45 +02:00
Justin M. Keyes
5b514b5988 Merge #5535 from justinmk/api_level
api: Nvim version + API level
2016-10-28 14:53:09 +02:00
Justin M. Keyes
c5f5f427c6 api: api_info()['version']
API level is disconnected from NVIM version. The API metadata holds the
current API level, and the lowest backwards-compatible level supported
by this instance.

Release 0.1.6 is the first release that reports the Nvim version and API
level.

    metadata['version'] = {
      major: 0,
      minor: 1,
      patch: 6,
      api_level: 1,
      api_compatible: 0,
      api_prerelease: false,
    }

The API level may remain unchanged across Nvim releases if the API has
not changed.

When changing the API,
    - set NVIM_API_PRERELEASE to true
    - increment NVIM_API_LEVEL (at most once per Nvim version)
    - adjust NVIM_API_LEVEL_COMPAT if backwards-compatibility was broken

api_level_0.mpack was generated from Nvim 0.1.5 with:
    nvim --api-info
2016-10-28 14:33:13 +02:00
Justin M. Keyes
fb4d5b0516 CheckHealth: check for sensible.vim 2016-10-28 13:54:08 +02:00
Rui Abreu Ferreira
f25797f869 api: Nvim version, API level #5386
The API level is disconnected from the NVIM version. The API metadata
holds the current API level, and the lowest backwards-compatible level
supported by this instance.

Release 0.1.6 will be the first release reporting the Nvim version and
API level.

    metadata['version'] = {
      major: 0,
      minor: 1,
      patch: 6,
      prerelease: true,
      api_level: 1,
      api_compatible: 0,
    }

The API level may remain unchanged across Neovim releases if the API has
not changed.

When changing the API the CMake variable NVIM_API_PRERELEASE is set to
true, and  NVIM_API_CURRENT/NVIM_API_COMPATIBILITY are incremented
accordingly.

The functional tests check the API table against fixtures of past
versions of Neovim. It compares all the functions in the old table with
the new one, it does ignore some metadata attributes that do not alter
the function signature or were removed since 0.1.5.  Currently the only
fixture is 0.mpack, generated from Neovim 0.1.5 with nvim --api-info.
2016-10-26 14:23:50 +02:00
Justin M. Keyes
90bf31c742 Merge #5500
Closes #5246
2016-10-26 14:01:49 +02:00
Justin M. Keyes
26b90e95e7 test: Add missing test from vim-patch:7.4.2312 2016-10-26 13:53:14 +02:00
Michael Ennen
e350902b7d vim-patch:7.4.2128 (#5517)
Problem:    Memory leak when saving for undo fails.
Solution:   Free allocated memory. (Hirohito Higashi)

1e2258297b
2016-10-26 13:27:00 +02:00
Florian Larysch
2a6c5bb0c4 modeline: Handle version number overflow. #5450
Closes #5449

A file containing the string "vim" followed by a very large number in a modeline
location will trigger an overflow in getdigits() which is called by
chk_modeline() when trying to parse the version number.

Add getdigits_safe(), which does not assert overflows, but reports them to the
caller.
2016-10-26 13:05:25 +02:00
Michael Ennen
0f32088ea2 vim-patch:7.4.2109 (#5518)
vim-patch:7.4.2109

Problem:    Setting 'display' to "lastline" is a drastic change, while
            omitting it results in lots of "@" lines.
Solution:   Add "truncate" to show "@@@" for a truncated line.

ad9c2a08f0
2016-10-25 21:15:43 +02:00
Justin M. Keyes
e828a5a76b Merge #5530 from justinmk/checkhealth
CheckHealth: more checks. Also hack around an infinite loop.
2016-10-25 20:42:04 +02:00
Justin M. Keyes
e8ddbbdf07 list_features(): Hack around infinite loop.
msg_putchar() is not updating msg_col, this causes an infinite loop. Observed
with execute('version') *nested* in another execute(), in particular this line:
    let buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+')
when called by :CheckHealth (see runtime/autoload/health/nvim ..
s:check_performance()).

But invoking some variation of execute('...execute("version")') is not enough to
provoke the bug, maybe it needs to be in a user function?
2016-10-25 15:55:29 +02:00
Justin M. Keyes
c853fd6fab CheckHealth: more checks 2016-10-25 15:55:29 +02:00
Justin M. Keyes
714ec09c6d version: Allow has("nvim-x"), has("nvim-x.y") 2016-10-25 13:08:48 +02:00
Justin M. Keyes
e7e2844d46 version: has("nvim-1.2.3")
Helped-by: Daniel Hahler <git@thequod.de>
2016-10-25 11:40:37 +02:00
Michael Ennen
f6f77272b3 vim-patch:7.4.1782
Problem:    strcharpart() does not work properly with some multi-byte
            characters.
Solution:   Use mb_cptr2len() instead of mb_char2len(). (Hirohito Higashi)

fca6600305
2016-10-24 12:49:17 -07:00
Justin M. Keyes
f96dfae52f doc; vim-patch.sh
Also include missing changes from:
06d2d38ab7
26852128a2
2016-10-24 13:26:55 +02:00
Justin M. Keyes
fb503d73da Merge #5483 from Shougo/vim-0648142
vim-patch 0648142, 91c4937, 06d2d38, 2685212, 269f595
2016-10-24 13:17:41 +02:00
Michael Ennen
6bc0d9b8c7 vim-patch:7.4.1779
Problem:    Using negative index in strcharpart(). (Yegappan Lakshmanan)
Solution:   Assume single byte when using a negative iindex.

73dfe917ba
2016-10-23 22:55:22 -07:00
Michael Ennen
b5dfdf0669 vim-patch:7.4.1742
Problem:    strgetchar() does not work correctly.
Solution:   use mb_cptr2len().  Add a test. (Naruhiko Nishino)

5d18e0eca5
2016-10-23 18:04:46 -07:00
Michael Ennen
9e5dca8490 vim-patch:7.4.1741
Problem:    Not testing utf-8 characters.
Solution:   Move the right asserts to the test_expr_utf8 test.

b22bd46b96
2016-10-23 18:04:46 -07:00
Michael Ennen
763422b036 vim-patch:7.4.1734
Problem:    Test fails when not using utf-8.
Solution:   Split test in regularand utf-8 part.

0f518a8f4d
2016-10-23 18:04:46 -07:00
Michael Ennen
d6e27f90b9 vim-patch:7.4.1730
Problem:    It is not easy to get a character out of a string.
Solution:   Add strgetchar() and strcharpart().

58de0e2dcc
2016-10-23 18:04:28 -07:00
Justin M. Keyes
43309d1993 test/api: Specify handling of VimL errors, v:errmsg.
TODO: Also spec behavior of Press-Enter prompt for these API functions.
2016-10-24 01:10:23 +02:00
Grzegorz Milka
d357a42389 Fix lint errors. 2016-10-23 01:17:39 +02:00
Grzegorz Milka
9755a2ffd5 vim-patch:7.4.2312
Problem:    Crash when autocommand moves to another tab. (Dominique Pelle)
Solution:   When navigating to another window halfway the :edit command go
            back to the right window.

5a49789a9b
2016-10-23 00:41:45 +02:00
Grzegorz Milka
c5c8a82134 vim-patch:7.4.2309
Problem:    Crash when doing tabnext in a BufUnload autocmd. (Dominique Pelle)
Solution:   When detecting that the tab page changed, don't just abort but
            delete the window where w_buffer is NULL.

11fbc2866c
2016-10-23 00:37:13 +02:00
Grzegorz Milka
d7b942b54e vim-patch:7.4.2237
Problem:    Can't use "." and "$" with ":tab".
Solution:   Support a range for ":tab". (Hirohito Higashi)

9b7f8ce9eb
2016-10-23 00:37:13 +02:00
Justin M. Keyes
fdc48cad7d Merge #5523 from justinmk/test-system
test: system(): Avoid indeterminism. Also adjust docs.
2016-10-23 00:33:51 +02:00
Justin M. Keyes
459a6ff058 test: system(): Avoid indeterminism. 2016-10-23 00:13:33 +02:00
Justin M. Keyes
8b8db9e158 api: documentation
Clarify behavior of v:errmsg and the Error object.
2016-10-23 00:13:33 +02:00
Grzegorz Milka
9ca90fdb9f vim-patch:7.4.2212
Problem:    Mark " is not set when closing a window in another tab. (Guraga)
Solution:   Check all tabs for the window to be valid. (based on patch by
            Hirohito Higashi, closes vim/vim#974)

e59215c7dc
2016-10-22 23:43:14 +02:00
Justin M. Keyes
500c485e36 Merge #5499 from tweekmonster/vim-8.0.0041
vim-patch: 8.0.0041, 8.0.0042, 8.0.0043
2016-10-22 23:36:04 +02:00
Grzegorz
e62f681d2d vim-patch:7.4.2227 (#5521)
Problem:    Tab page tests are old style.
Solution:   Change into new style tests. (Hirohito Higashi)

1381d79147
2016-10-22 23:22:50 +02:00
Tommy Allen
f2af6177fb vim-patch:8.0.0043
Problem:    When using Insert mode completion with 'completeopt' containing
            "noinsert" with CTRL-N the change is not saved for undo.  (Tommy
            Allen)
Solution:   Call stop_arrow() before inserting for any key.
2016-10-22 15:15:27 -04:00
Tommy Allen
d733beb0be vim-patch:8.0.0042
Problem:    When using Insert mode completion with 'completeopt' containing
            "noinsert" change is not saved for undo.  (Tommy Allen)
Solution:   Call stop_arrow() before inserting for pressing Enter.
2016-10-22 15:15:27 -04:00
Tommy Allen
c377c8be61 vim-patch:8.0.0041
Problem:    When using Insert mode completion but not actually inserting
            anything an undo item is still created. (Tommy Allen)
Solution:   Do not call stop_arrow() when not inserting anything.
2016-10-22 15:15:21 -04:00
Björn Linse
31df051ed9 Merge pull request #4568 from bfredl/multirequest
atomic multi request for async remote plugins
2016-10-22 12:50:50 +02:00
Björn Linse
f6968dc0f7 api: call multiple methods atomically (useful in async contexts)
remove unused response_id parameter of handle_nvim_... helpers
2016-10-22 10:51:32 +02:00
Shougo Matsushita
e904186277 vim-patch: mark applied #5381
vim-patch:b20617b
Add OSX build to Travis CI. (Christian Brabandt)
b20617b0b0

vim-patch:471a897
Update gitignore for new test binary.  (Oyvind Holm, closes vim/vim#954)
471a897569

vim-patch:2cb70a2
Put building with interfaces on the right target.
2cb70a2744

vim-patch:87776a1
Correct build condition.
87776a1ac1

vim-patch:8de7465
Add missing "then".
8de7465d77

vim-patch:1a9f947
Add a separate build target for the unittests. Hopefully the coverage will be merged then.
1a9f947cde

vim-patch:8211fcb
Run unittests before scripttests.  Hopefully does not mess up coverage.
8211fcbdc9

vim-patch:8e77bad
Add json_test to gitignore (Hirohito Higashi)
8e77bad3c1
2016-10-21 23:00:57 +02:00
Justin M. Keyes
1ff162c0d9 os_nodetype: open fd with O_NONBLOCK (#5515)
Closes #5267

Helped-by: oni-link <knil.ino@gmail.com>
2016-10-21 22:03:01 +02:00
Michael Ennen
82f30bfeda [RFC] vim-patch:7.4.1704 (#5487)
vim-patch:7.4.1704

Problem:    Using freed memory with "wincmd p". (Dominique Pelle)
Solution:   Also clear "prevwin" in other tab pages.

3dda7db4e1
2016-10-21 12:55:57 -04:00
Justin M. Keyes
6636e2a259 test: :terminal should not interrupt Press-ENTER
References #2748
2016-10-20 23:41:59 +02:00
James McCoy
5bcb7aa8bf Merge pull request #5441 from Shougo/vim-7.4.1588
vim-patch:7.4.1588
2016-10-20 10:47:42 -04:00
James McCoy
1ad5a970ce Merge pull request #5440 from Shougo/vim-7.4.1565
vim-patch:7.4.1565
2016-10-20 10:28:03 -04:00
James McCoy
978c1fd11f Merge pull request #5503 from jamessan/vim-7.4.1494
vim-patch:7.4.1494
2016-10-20 09:40:07 -04:00
Colin Caine
e19234f391 man.vim: silence file call (#5509)
When a file is opened by nvim with ft=man already set, and
"has('vim_starting')", ftplugin/man.vim calls
'execute 'file man://'.ref', this causes nvim to display something like
this:

````
"<name of original file>" 977, 41017C
"man://foo(1)" [Not edited] 977 lines --0%--
Press ENTER or type command to continue
````

This is annoying, because nothing of note has actually happened.

Use cases why you might want to read a man page from a file:

`MANPAGER='bash -c "nvim -c \"set ft=man\" </dev/tty <(col -bx)"' man git`
`nvim -c 'set ft=man' <(man -P cat git)`
2016-10-20 08:35:48 +02:00
Björn Linse
13262aef7a Merge pull request #5507 from bfredl/terminal_api
tests: fix racyness in terminal/api_spec.lua
2016-10-19 22:12:37 +02:00
Björn Linse
d1070787ca tests: fix racyness in terminal/api_spec.lua
Previously, the nvim_input from the socket channels could be processed
before the input from stdin in rare cases.
2016-10-19 15:21:49 +02:00
Björn Linse
2d961403ba Merge pull request #5393 from bfredl/dispatchfix
refactor gendispatch.lua to move verbatim c code to .c files
2016-10-19 15:16:05 +02:00
Björn Linse
caf85b80ae api: move verbatim c code out of gendispatch.lua and into c files
Remove max_fname_len check, which caused false successful lookups,
and was an optimization for a very rare case.
2016-10-19 09:06:30 +02:00
Shougo Matsushita
9d4fcec7c6 folds: Do not auto-update folds for some foldmethods. #5426 2016-10-19 02:22:55 +02:00
Justin M. Keyes
6a6f188d2a Merge #5502 from justinmk/error-write-to-bg-process
system('foo &', 'bar'): Show error, don't crash.
2016-10-19 02:09:29 +02:00
Justin M. Keyes
9706664b88 system('foo &', 'bar'): Show error, don't crash.
Closes #3529
Closes #5241

In Vim,
    :echo system('cat - &', 'foo')
works because for both system() and :! Vim writes input to a temp file and uses
shell syntax to redirect the file to the backgrounded `cat` (get_cmd_output()
.. make_filter_cmd()).

In Nvim,
    :echo system('cat - &', 'foo')
fails because we write the input directly via pipes (shell.c:do_os_system()),
but (per POSIX[1]) backgrounded process input stream is redirected from
/dev/null (unless overridden by shell redirection; supported only by some shells
[2]), so our writes are ignored, the process exits quickly, and if we are
writing data larger than the buffer size we'll see EPIPE.

This still works:
    :%w !tee > foo1358.txt &
but this does not:
    :%w !tee foo1358.txt &
though it *should* (why doesn't it?) because we still do the temp file dance
in do_bang() .. do_filter().

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02
[2] http://unix.stackexchange.com/a/71218
2016-10-19 01:39:05 +02:00
Justin M. Keyes
16da3a6fe0 test: system(): backgrounded shell command
These tests are essentially affirming a regression vs Vim. In Vim,
    :echo system('cat - &', 'foo')
returns "foo", because Vim internally wraps the command with shell-specific
syntax to redirect the streams from /dev/null[1].

That can't work in Nvim because we use pipes directly (instead of temp files)
and don't wrap the command with shell-specific redirection syntax.

References #3529
References #5241

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_03_02
2016-10-19 01:01:27 +02:00
Marco Hinz
657ba62a84 rplugin: resolve paths in manifest file (#5501)
`:CheckHealth nvim` would always report an outdated manifest if symlinks were
used, because the manifest file contains unresolved paths that get compared
against resolved paths.

Now we resolve paths before they get written to the manifest file.
2016-10-18 23:16:13 +02:00
James McCoy
73da9fdafd hist_char2type: Return '/' for NUL.
During -S execution, ccline.cmdfirstc is NULL, so calling histadd() with
a hist-name of '' would fail.  Mimic Vim's behavior and fallback to '/'
in this scenario, since '' is a documented hist-name as of
vim/vim@3e496b0e.
2016-10-18 10:48:29 -04:00
Patrick
6bbd4b2298 vim-patch:7.4.1494
Problem:    clr_history() does not work properly.
Solution:   Increment hisptr. Add a test. (Yegappan Lakshmanan)

119d4693e0

Note: Only added a test. The change to `histptr` had already been made.
2016-10-18 10:34:40 -04:00
Marco Hinz
869a9078e1 Doc: Ruby omni-completion works (#5497) 2016-10-17 19:49:57 +02:00
Justin M. Keyes
fbd6b10e1b Merge #5493 from justinmk/checkhealth
CheckHealth: check tmux, terminfo
2016-10-16 20:14:14 +02:00
Justin M. Keyes
acdc0b1955 CheckHealth: check terminfo 2016-10-16 18:14:24 +02:00
Justin M. Keyes
c40b3b680d CheckHealth: check tmux configuration 2016-10-16 18:08:53 +02:00
Justin M. Keyes
6fc122e600 doc 2016-10-16 18:08:53 +02:00
Marco Hinz
0fa4f98a05 Revert "Makefile: add PREFIX variable"
This reverts commit c13f72ee0a.

References #5447.
2016-10-16 12:17:00 +02:00
Justin M. Keyes
97caabc49a test: execute_spec: Adjust screen assertion.
The previous form was passing because it happens immediately before this form;
 but on a very fast(?) server the screen check might miss that form. It's also
 not really want we want to assert anyways.
2016-10-15 22:16:48 +02:00
Michael Ennen
3a2903c836 vim-patch: 7.4.1619 (#5475)
Problem:    When 'fileformats' is set in the vimrc it applies to new buffers
            but not the initial buffer.
Solution:   Set 'fileformat' when starting up. (Mike Williams)

364fa5c7ec
2016-10-16 00:02:31 +02:00
Shougo
4169fc8281 vim-patch:7.4.1833 (#5484)
Problem:    Cannot use an Ex command for 'keywordprg'.
Solution:   Accept an Ex command. (Nelo-Thara Wallus)

2ff8b64679
2016-10-15 23:59:23 +02:00
James McCoy
b268ba353a Merge pull request #5424 from jamessan/win-tab-nr
api: Support getting the number of a window/tabpage
2016-10-15 15:29:53 -04:00
James McCoy
885db120fa Merge pull request #5456 from jamessan/char-sign-conversion
Enable CI testing of unsigned char and fix fallout
2016-10-15 15:29:13 -04:00
Björn Linse
9477c5bb5b Merge pull request #5384 from bfredl/getchar_event
allow event processing in getchar()
2016-10-15 10:36:34 +02:00
Björn Linse
719dae2e01 events: allow event processing in getchar()
this is consistent with vim, and is necessary for plugins that implement
their own input modes using "getchar()" and still want to do async
event processing.
2016-10-15 09:50:59 +02:00
Shougo Matsushita
3bb388664d vim-patch:7.4.1565
Problem:    Crash when assert_equal() runs into a NULL string.
Solution:   Check for NULL. (Dominique) Add a test.

f155196444
2016-10-15 14:25:50 +09:00
Shougo Matsushita
c91a0dca02 vim-patch:269f595
Updated runtime files.

269f595f9e
2016-10-15 12:21:13 +09:00
Shougo Matsushita
f3efb724af vim-patch:2685212
Update runtime files.

26852128a2
2016-10-15 12:15:36 +09:00
Shougo Matsushita
40f853398e vim-patch:06d2d38
Updated runtime files.

06d2d38ab7
2016-10-15 12:12:20 +09:00
Shougo Matsushita
59aa2eb501 vim-patch:91c4937
Updated runtime files.

91c4937be1
2016-10-15 12:03:57 +09:00
Shougo Matsushita
9d087206ab vim-patch:0648142
Update runtime files.

0648142700
2016-10-15 11:51:46 +09:00
Shougo Matsushita
41ab095399 vim-patch:7.4.1588
Problem:    Old style test for quickfix.
Solution:   Turn test 96 into a new style test.

1ff2b64b11
2016-10-15 11:09:03 +09:00
Linda_pp
79d77da8a0 startup: Remove 'N files to edit' message. #5481
Problem:
    When '--embed' passed to command line arguments, stdin and stdout
    are used for IPC. But when multiple files are passed as
    arguments, nvim wrongly sends 'N files to edit' message to its
    stdout. As the result, attaching to process from frontend failed.

Solution:
    Remove the message because it doesn't fill any purpose.
2016-10-14 18:12:10 +02:00
Justin M. Keyes
819b79dbc5 health/provider.vim: Pass errors through. Give more feedback. 2016-10-13 17:55:15 +02:00
Justin M. Keyes
c9b9f052cc Revert "tui: Move ui_bridge module to tui/ namespace."
ui_bridge.c is useful for libnvim consumers, not just the built-in TUI.

This reverts commit beb2e4f095.
2016-10-13 16:05:06 +02:00
Justin M. Keyes
294c0ba014 health/provider.vim: Fix system([]) invocations.
Closes #5435
2016-10-13 15:17:24 +02:00
Justin M. Keyes
5060ebc5d0 test/tui_spec: Force LANG=C
References #5455
2016-10-13 14:20:03 +02:00
Justin M. Keyes
5a61ff188c Merge #5257 from jbradaric/vim-7.4.1893
vim-patch:7.4.{1893,1895}
2016-10-13 01:19:09 +02:00
Justin M. Keyes
22fe76aec4 Merge #5418 from Shougo/vim-7.4.2158
vim-patch: 7.4.2158, 2162, 2205
2016-10-13 00:44:18 +02:00
Justin M. Keyes
6a2d40497a Merge #5427 from Shougo/vim-7.4.1714
vim-patch: 7.4.1765, 7.4.1714
2016-10-13 00:22:23 +02:00
Justin M. Keyes
51937e1322 Merge #5470 from justinmk/pr5445 2016-10-13 00:13:39 +02:00
Justin M. Keyes
e9fd1244b7 doc
yuck
2016-10-13 00:06:32 +02:00
Justin M. Keyes
8fb7972517 doc 2016-10-12 23:52:41 +02:00
Harm te Hennepe
3a54ce5a73 vim-patch:7.4.2274 (#5439)
Problem:    Command line completion on "find **/filename" drops sub-directory.
Solution:   Handle this case separately. (Harm te Hennepe, closes vim/vim#932, closes
            vim/vim#939)

73d4e4c892
2016-10-12 23:01:11 +02:00
James McCoy
68f7464eed ui: Blank the next cell for any multi-cell character
Followup for #5461
2016-10-12 16:32:53 -04:00
Justin M. Keyes
6b7faf22f4 main.c: "BufReadCmd term://": Skip existing terminal.
Check `exists('b:term_title')` to avoid the BufReadCmd for already-initialized
:terminal buffers.

Move the test for `:argadd`.
Add a test for `:edit<CR>`.
Tweak comments and code style.
2016-10-12 21:37:08 +02:00
James McCoy
6bc3bcefc6 Merge pull request #5461 from jamessan/emoji-ui-regression
ui: Fix the call to utf_ambiguous_width
2016-10-12 12:53:44 -04:00
Harm te Hennepe
538255c228 terminal: Move re-edit detection to do_ecmd(). #5445
Closes #4784
2016-10-12 14:56:20 +02:00
John Szakmeister
cb351c678b Merge pull request #5467 from jszakmeister/prevent-in-tree-builds
build: prevent in-tree builds for the time being, as it's not supported
2016-10-12 04:03:15 -04:00
John Szakmeister
f098e53e6f Merge pull request #5466 from jszakmeister/fix-generated-files-for-in-tree-build
Fix generated files for in-tree build.
2016-10-12 04:02:47 -04:00
Justin M. Keyes
0190b9fb92 Merge #5463 from justinmk/te-skip-writes
term_write(): Skip writes if stream was closed.
2016-10-12 08:45:30 +02:00
Justin M. Keyes
b182f247ec eval/term_write(): Skip writes if stream was closed.
If the backing stream for a :terminal was closed (e.g. if the shell exits
unexpectedly) there may be pending input on the loop which will be processed
before the terminal close event (which is queued on the same loop).

terminal_send checks term->closed but this does not reflect the state of the
underlying streams. The terminal.c module in fact has no knowledge of the
streams (this seems intentional: it is abstracted as TerminalOption.write_cb).

The SIGCHLD handler (pty_process_unix.c) is executed immediately, and it
triggers a stream teardown so Stream.closed=false (TerminalJobData.in.closed).
When the pending writes are handled by eval.c:term_write, wstream_write() aborts
because it sees the closed Stream.

To avoid that, this commit checks Stream.closed in eval:term_write() before writing
to the WStream. (As hinted above, we cannot do this in terminal:terminal_send()
because that module cannot inspect the underlying streams.)

References #5445
https://github.com/neovim/neovim/pull/5445#issuecomment-252529766
2016-10-12 04:33:53 +02:00
Justin M. Keyes
ef4676ed5b test/terminal: Cover race when :term shell process exits.
References #5445

See https://github.com/neovim/neovim/pull/5445#issuecomment-252529766
2016-10-12 04:33:53 +02:00
John Szakmeister
baaddf358b build: fix generated file paths when building in-tree 2016-10-11 20:46:27 -04:00
John Szakmeister
53eddb881c build: prevent in-tree builds for the time being, as it's not supported 2016-10-11 20:20:31 -04:00
Shougo
1dde512498 UpdateRemotePlugins: Discard duplicate paths. (#5464) 2016-10-12 01:04:59 +02:00
James McCoy
892f55bd20 ui: Fix the call to utf_ambiguous_width
`utf_ambiguous_width` expects the Unicode character, but in 9e1c6596 I
just passed the first UTF-8 byte to the function.  This led to various
display problems because now many multi-cell characters weren't falling
into that part of the branch.

Also, to better align with the existing Vim code, remove the forced
cursor update.  Setting the flag will cause it to happen in the next
UI_CALL.

Thanks to qvacua for all the help investigating the issue!

Closes #5448
2016-10-11 18:59:01 -04:00
James McCoy
f1bc50d7da Merge pull request #5457 from jamessan/wincmd-count
window: Fix cmd_with_count's formatting when sizeof(long) != 8
2016-10-11 18:57:06 -04:00
James McCoy
d545c8e1ce window: Fix cmd_with_count's formatting when sizeof(long) != 8
On architectures where `sizeof(long)` != 8, "%" PRId64 will read junk from
memory.  This was seen on various Debian builds where
test/functional/legacy/close_count_spec.lua would fail due to `1<C-w>c`
emitting an error like `E488: Trailing characters: close-87944975647104`.

Changing the `Prenum` parameter to int64_t ensures it is safe to use
`"%" PRId64`, and make another small step towards removal of the use of
`long`.
2016-10-11 16:22:24 -04:00
James McCoy
1dd98a03aa lint 2016-10-09 22:06:45 -04:00
James McCoy
8fd12805d7 if_cscope: Fix conversion warnings when char defaults to unsigned
../src/nvim/if_cscope.c: In function 'cs_read_prompt':
    ../src/nvim/if_cscope.c:1771:47: warning: comparison is always true due to limited range of data type [-Wtype-limits]
         while ((ch = (char)getc(csinfo[i].fr_fp)) != EOF && ch != CSCOPE_PROMPT[0])
                                                   ^~
    ../src/nvim/if_cscope.c:1804:14: warning: comparison is always false due to limited range of data type [-Wtype-limits]
           if (ch == EOF) {
                  ^~
    ../src/nvim/if_cscope.c:1816:14: warning: negative integer implicitly converted to unsigned type [-Wsign-conversion]
             ch = EOF;
                  ^~~
    ../src/nvim/if_cscope.c:1821:12: warning: comparison is always false due to limited range of data type [-Wtype-limits]
         if (ch == EOF)
                ^~

Since EOF is -1, it will be converted to a large unsigned value to
compare with unsigned char and never match.  Use an int to store the
return from getc so we can safely compare it and, once known to be
valid, cast it to char when storing it into buf.

Signed-off-by: James McCoy <jamessan@jamessan.com>
2016-10-09 21:13:08 -04:00
James McCoy
4192c411a8 Change constack.cs_flags from char to int
This fixes the -Wconversion warning when char's type is unsigned.

    ../src/nvim/ex_eval.c: In function 'ex_while':
    ../src/nvim/ex_eval.c:1000:28: warning: conversion to 'char' from 'int' may alter its value [-Wconversion]
           cstack->cs_lflags &= ~CSL_HAD_LOOP;
                                ^

Signed-off-by: James McCoy <jamessan@jamessan.com>
2016-10-09 21:13:07 -04:00
James McCoy
cb03517fd3 ci: Force unsigned char usage for the 32bit build
Since C leaves whether char is signed or unsigned up to the implementer,
there are different defaults on different architectures.

Forcing unsigned char for one of our CI builds should help catch these
issues moving forward.
2016-10-09 21:12:45 -04:00
James McCoy
4408431086 Merge pull request #5411 from P4Cu/vim-7.4.1549
vim-patch:7.4.1549
2016-10-08 20:51:32 -04:00
James McCoy
27ced483cc Merge pull request #5447 from mhinz/makefile/add-prefix
Makefile: add PREFIX variable
2016-10-08 20:38:32 -04:00
James McCoy
26a6ed55c6 Merge pull request #5451 from jamessan/set-username-hostname
config: Allow setting USERNAME/HOSTNAME from the environment
2016-10-08 20:28:01 -04:00
James McCoy
9b0b281b75 config: Allow setting USERNAME/HOSTNAME from the environment
Allowing this to be controlled externally improves reproducibility, as
well as provides a more useful address to report for "Compiled by".  For
example, I intend to set it to the packaging list when building the
Debian package.

Signed-off-by: James McCoy <jamessan@jamessan.com>
2016-10-08 14:22:36 -04:00
Marco Hinz
c13f72ee0a Makefile: add PREFIX variable
We use a Makefile which in turn uses cmake. If we wanted to set the install
prefix for cmake, we had to do this so far:

  make CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=/tmp/nvim"

That's long and hard to remember. Following the conventions of other Makefiles,
this now works as well and is equivalent:

  make PREFIX=/tmp/nvim
2016-10-08 18:39:35 +02:00
Justin M. Keyes
1984072822 Merge #5428 'vim-patch: 0c1ff16, 939a1ab, 8067a64'. 2016-10-08 17:17:43 +02:00
Marco Hinz
31f6334aa8 CheckHealth: choose correct path for the latest version (#5446)
If multiple versions of a package are installed, the provider health check could
choose a wrong path:

  /usr/local/lib/python3.5/site-packages/neovim-0.1.10-py3.5.egg-info/PKG-INFO
  /usr/local/lib/python3.5/site-packages/neovim-0.1.9-py3.5.egg-info/PKG-INFO

Prior to this change :CheckHealth could falsely show 0.1.9 as the installed
version, since glob() doesn't enforce any predictable order.

Now we sort all potential paths numerically in descending order and just look at
the first path instead.
2016-10-08 16:34:54 +02:00
Justin M. Keyes
91d13bd861 hardcopy.c: Fix -Wmaybe-uninitialized warning. 2016-10-08 00:05:50 +02:00
Patrick Jackson
09e0c96201 lint: Removing dead initializations #5410 2016-10-08 00:01:03 +02:00
Jurica Bradaric
1b61bd93ae server_requests_spec: Expect correct window ID. 2016-10-07 17:07:17 +02:00
Jurica Bradaric
61024fb4a8 eval: Exit early if argument is invalid. 2016-10-07 17:07:17 +02:00
Jurica Bradaric
50bd8297e6 vim-patch:7.4.1895
Problem:    Cannot use a window ID where a window number is expected.
Solution:   Add LOWEST_WIN_ID, so that the window ID can be used where a
            number is expected.

888ccac890
2016-10-07 17:07:16 +02:00
Jurica Bradaric
d8079e5ab7 vim-patch:7.4.1893
Problem:    Cannot easily get the window ID for a buffer.
Solution:   Add bufwinid().

b3619a90ea
2016-10-07 17:07:16 +02:00
Justin M. Keyes
b6300742d2 Merge #5444 from malept/dont-hardcode-python3-in-checkhealth
Fix Python 2/3 health checks
2016-10-07 12:15:49 +02:00
Mark Lee
a8f9d56796 health: fix Python 2 variable names 2016-10-06 22:09:36 -07:00
Mark Lee
153e6835f1 health: remove duplicate nvim_path declaration
It's the same as the declaration above it, but hardcoded to use python3
and does not redirect stderr.
2016-10-06 22:09:10 -07:00
Shougo
2ef1b68751 version.c: mark NA patches (#5380)
NA list:

1653: matchit packadd
1750: channel
1770: termguicolors
1794: GUI Win32
1805: Makefile
1804, 1945: manpager.vim
1811: channel
2115, 2232, 2278, 2319: defaults.vim

included:
1763: spell
2016-10-06 16:22:20 +02:00
Florian Larysch
e83845285c tui/flush_buf: Don't toggle cursor when called from out() #5436
unibi_format() calls out() multiple times for a given format string.
When data->buf fills up during this process, flush_buf() gets called,
which possibly calls unibi_out() again to toggle the cursor visibility.
However, if we were halfway through outputting an escape sequence, doing
this will clobber it, resulting in junk being displayed.

Fix this by not toggling the cursor visibility when draining a full
buffer in out().
2016-10-06 15:57:24 +02:00
Justin M. Keyes
d57f25e5ef doc/vim_diff.txt (#5432) 2016-10-06 09:45:24 +02:00
James McCoy
1ebb75b1ec api: Support getting the number of a window/tabpage
In order to provide better compatibility with the classic bindings, the
API needs to provide the ability to query the number (really index) of
the window/tabpage.

This is needed for neovim/python-client#87, as discussed in
neovim/neovim#1898.

Signed-off-by: James McCoy <jamessan@jamessan.com>
2016-10-04 14:34:35 -04:00
James McCoy
b1edc8abb7 Merge pull request #5366 from NovaDev94/vim-7.4.1740
vim-patch:7.4.1740
2016-10-04 13:14:56 -04:00
Shougo Matsushita
7bc86b2bbc vim-patch:0c1ff16
updated runtime files.  Add avra syntax.

0c1ff16b54
2016-10-04 23:34:28 +09:00
Shougo Matsushita
d4f32d0789 vim-patch:939a1ab
Updated runtime files.

939a1abe93
2016-10-04 23:33:28 +09:00
Shougo Matsushita
31a29e41b0 vim-patch:8067a64
Add missing test file.

8067a64852
2016-10-04 23:25:37 +09:00
Shougo Matsushita
fdb0a5e24e vim-patch:7.4.1765
Problem:    Undo options are not together in the options window.
Solution:   Put them together.  (Gary Johnson)

4694a17d1e
2016-10-04 23:18:24 +09:00
Shougo Matsushita
c3990ba0e6 vim-patch:7.4.1714
Problem:    Non-GUI specific settings in the gvimrc_example file.
Solution:   Move some settings to the vimrc_example file.  Remove setting
            'hlsearch' again. (suggested by Hirohito Higashi)

54f1b7abf8
2016-10-04 23:14:47 +09:00
Justin M. Keyes
eeec0cab58 tui/terminfo_start: Default to normal-mode cursor shape. (#5419)
References #4867

For users who use a "bar" shape in the shell, it's annoying that Nvim starts
with that same cursor shape, despite starting in normal-mode. So default to the
normal-mode "block" shape instead. (Note: technically it's possible some user
may set 'insertmode', and then the opposite problem occurs. But 'insertmode' is
a silly option that shouldn't exist, and any user that uses it probably isn't
fiddling with their cursor shape anyways.)

Also rename the unibilium extensions:
    enter_insert_mode   => set_cursor_shape_bar
    enter_replace_mode  => set_cursor_shape_underline
    exit_insert_mode    => set_cursor_shape_block
to say explicitly what they do in the context of a terminal; it's irrelevant in
this context what purpose they serve in Nvim.
2016-10-02 03:41:11 +02:00
Justin M. Keyes
91e9c0a7ee ci: .travis.yml: Minimize scope of osx_image directive. (#5420) 2016-10-02 03:37:17 +02:00
Justin M. Keyes
6186df3562 event/multiqueue.c: Rename "queue" to "multiqueue".
`lib/queue.h` implements a basic queue. `event/queue.c` implements
a specialized data structure on top of lib/queue.h; it is not a "normal"
queue.

Rename the specialized multi-level queue implemented in event/queue.c to
"multiqueue", to avoid confusion when reading the code.

Before this change one can eventually notice that "macros (uppercase
symbols) are for the normal queue, lowercase operations are for the
multi-level queue", but that is unnecessary friction for new developers
(or existing developers just visiting this part of the codebase).
2016-10-02 00:24:49 +02:00
Shougo Matsushita
db324879d2 vim-patch:7.4.2205
Problem:    'wildignore' always applies to getcompletion().
Solution:   Add an option to use 'wildignore' or not. (Yegappan Lakshmanan)

e9d58a6459
2016-10-01 20:07:27 +09:00
Shougo Matsushita
de802fd4d2 vim-patch:7.4.2162
Problem:    Result of getcompletion('', 'sign') depends on previous
            completion.
Solution:   Call set_context_in_sign_cmd(). (Dominique Pelle)

7522f69821
2016-10-01 19:54:35 +09:00
Shougo Matsushita
aeebed8d61 vim-patch:7.4.2158
Problem:    Result of getcompletion('', 'cscope') depends on previous
            completion. (Christian Brabandt)
Solution:   Call set_context_in_cscope_cmd().

b650b9878e
2016-10-01 19:54:28 +09:00
Andrzej Pacanowski
9959113746 vim-patch:7.4.1549
Problem:    Test for syntax attributes fails in Win32 GUI.
Solution:   Use an existing font name.

c835293d54
2016-09-30 15:27:18 +02:00
James McCoy
c8b6ec2e6a Merge pull request #5409 from jamessan/toplevel-state
Correct logic for setting NormalState.toplevel
2016-09-30 08:25:15 -04:00
James McCoy
3a59b04c19 Correct logic for setting NormalState.toplevel
In Vim's main_loop function, the main loop is

        while (!cmdwin
    #ifdef FEAT_CMDWIN
                || cmdwin_result == 0
    #endif
                )
        {
    ...
    #ifdef FEAT_EVAL
            /*
             * May perform garbage collection when waiting for a character, but
             * only at the very toplevel.  Otherwise we may be using a List or
             * Dict internally somewhere.
             * "may_garbage_collect" is reset in vgetc() which is invoked through
             * do_exmode() and normal_cmd().
             */
            may_garbage_collect = (!cmdwin && !noexmode);
    #endif
            /*
             * If we're invoked as ex, do a round of ex commands.
             * Otherwise, get and execute a normal mode command.
             */
            if (exmode_active)
            {
                if (noexmode)   /* End of ":global/path/visual" commands */
                    return;
                do_exmode(exmode_active == EXMODE_VIM);
            }
            else
                normal_cmd(&oa, TRUE);
        }

cmdwin_result is set to 0 before calling main_loop to handle the cmdwin
window and gets changed when the user causes a command to execute
(either through pressing <CR> or <C-c>).  This means that when the
cmdwin isn't active OR the user is still editing their command,
main_loop runs and main_loop calls normal_cmd with toplevel true as long
as exmode isn't active.

When the normal mode state was extracted in dae006a9, the conditions for
toplevel and may_garbage_collect were combined.  Since toplevel was set
to always ignore cmdwin, the v:count(1) variables were no longer being
updated when a command was prefixed with a count in the cmdwin.

Closes #5404
2016-09-30 07:29:25 -04:00
James McCoy
724675061c Merge pull request #5358 from jbradaric/vim-7.4.1679
vim-patch:7.4.{1648,1679,1681}
2016-09-28 20:35:29 -04:00
Jurica Bradaric
b0aa748e14 vim-patch:7.4.1681
Problem:    Coverity warns for fixed size buffer length (false positive).
Solution:   Add a check for the name length.

ef9d9b94a8
2016-09-28 21:45:07 +02:00
Jurica Bradaric
7531410169 vim-patch:7.4.1679
Problem:    Coverity: copying value of v_lock without initializing it.
Solution:   Init v_lock in rettv_list_alloc() and rettv_dict_alloc().

7d2a5796d3
2016-09-28 21:36:11 +02:00
Jurica Bradaric
42731a9a15 vim-patch:7.4.1648
Problem:    Compiler has a problem copying a string into di_key[]. (Yegappan
            Lakshmanan)
Solution:   Add dictitem16_T.

bee6c0cf86
2016-09-28 21:36:11 +02:00
Justin M. Keyes
87fa495b21 Merge #5395 from justinmk/log 2016-09-28 12:46:03 +02:00
Justin M. Keyes
7e6a8310b7 log.c: align/adjust layout
New:
  2016/09/27 18:00:49 INFO  28117/tui_flush:597: ...

Old:
  2016/09/27 18:00:49 [info @ tui_flush:597] 28117 - ...
2016-09-28 03:29:55 +02:00
Justin M. Keyes
beb2e4f095 tui: Move ui_bridge module to tui/ namespace. 2016-09-28 03:29:54 +02:00
Justin M. Keyes
9c2f4ce20d doc: minor comment tweaks 2016-09-28 03:01:57 +02:00
Björn Linse
22dfe6925d Merge pull request #5389 from bfredl/apifix
restore ui_try_resize metadata and filter metadata attributes, and add "since" attribute
2016-09-27 18:25:55 +02:00
James McCoy
45d5b78aec Merge pull request #5357 from jbradaric/vim-7.4.1671
vim-patch:7.4.{1671,1818,1820,1821}
2016-09-27 11:55:05 -04:00
James McCoy
36ffb6a7d8 Merge pull request #5261 from jbradaric/vim-7.4.1961
vim-patch:7.4.1961
2016-09-27 11:16:57 -04:00
Björn Linse
78ea090f29 api: add blanket implementation of "since" 2016-09-27 16:54:55 +02:00
Björn Linse
50c26017a3 api: define the set of function attributes to expose in the metadata 2016-09-27 16:54:55 +02:00
Björn Linse
6f55d1377f api: restore old return type of deprecated ui_try_resize method 2016-09-27 16:10:34 +02:00
James McCoy
ddb9f02712 Merge pull request #5356 from jbradaric/vim-7.4.1670
vim-patch:7.4.1670
2016-09-26 22:51:37 -04:00
James McCoy
f610b807b4 Merge pull request #5372 from jamessan/vim-7.4.1604
vim-patch:7.4.1604,7.4.1620,7.4.1629,7.4.1630,7.4.1642,7.4.1697

Closes #5149
2016-09-26 22:16:17 -04:00
Jurica Bradaric
b6f8c35cf7 vim-patch:7.4.1821
Problem:    Test fails on MS-Windows.
Solution:   Sort the completion results.

4ed6b2e2d7
2016-09-25 22:55:13 +02:00
Jurica Bradaric
9114790c4c vim-patch:7.4.1820
Problem:    Removing language from help tags too often.
Solution:   Only remove @en when not needed. (Hirohito Higashi)

9ccaae04c6
2016-09-25 22:06:57 +02:00
Jurica Bradaric
641d424290 vim-patch:7.4.1818
Problem:    Help completion adds @en to all matches except the first one.
Solution:   Remove "break", go over all items.

89c79b9932
2016-09-25 22:06:57 +02:00
Jurica Bradaric
6e55d99f43 vim-patch:7.4.1671
Problem:    When help exists in multiple languages, adding @ab while "ab" is
            the default help language is unnecessary.
Solution:   Leave out "@ab" when not needed. (Ken Takata)

61264d9969
2016-09-25 22:06:57 +02:00
Jurica Bradaric
6ca089fd8d option.c: Fix linter errors. 2016-09-25 21:29:12 +02:00
Jurica Bradaric
e74c2334f2 vim-patch:7.4.1961
Problem:    When 'insertmode' is reset while doing completion the popup menu
            remains even though Vim is in Normal mode.
Solution:   Ignore stop_insert_mode when the popup menu is visible.  Don't set
            stop_insert_mode when 'insertmode' was already off. (Christian
            Brabandt)

00672e1d3f
2016-09-25 21:29:12 +02:00
James McCoy
4ce24ff9da genunicodetables: Give the unicode directory as the first argument
Let genunicodetables determine which files it needs from the unicode
directory.  cmake just needs to pass the directory and destination file
to the script.
2016-09-24 20:46:09 -04:00
James McCoy
9e1c659666 vim-patch:7.4.1697
Problem:    Display problems when the 'ambiwidth' and 'emoji' options are not
            set properly or the terminal doesn't behave as expected.
Solution:   After drawing an ambiguous width character always position the
            cursor.

cb0700844c
2016-09-24 15:02:51 -04:00
James McCoy
9419a4c86c lint 2016-09-24 14:03:23 -04:00
James McCoy
dafca1ad68 vim-patch:7.4.1642
Problem:    Handling emoji characters as full width has problems with
            backwards compatibility.
Solution:   Only put characters in the 1f000 range in the emoji table.

6a08454b93
2016-09-24 14:03:23 -04:00
James McCoy
e161d6a19d vim-patch:7.4.1630
Problem:    Unicode table for double width is outdated.
Solution:   Update to the latest Unicode standard.

d63aff0a65
2016-09-24 14:03:23 -04:00
James McCoy
1144cc6d9e vim-patch:7.4.1629
Problem:    Handling emoji characters as full width has problems with
            backwards compatibility.
Solution:   Remove ambiguous and double width characters from the emoji table.
            Use a separate table for the character class.
            (partly by Yashuhiro Matsumoto)

b86f10ee10
2016-09-24 14:03:22 -04:00
James McCoy
45598d2e5e vim-patch:7.4.1620
Problem:    Emoji characters are not considered as a kind of word character.
Solution:   Give emoji characters a word class number. (Yashuhiro Matsumoto)

4077b33a83
2016-09-24 14:03:22 -04:00
James McCoy
49735d6fae Update unicode files 2016-09-24 14:03:22 -04:00
James McCoy
d533edf61e vim-patch:7.4.1604
Problem:    Although emoji characters are ambiguous width, best is to treat
            them as full width.
Solution:   Update the Unicode character tables. Add the 'emoji' options.
            (Yasuhiro Matsumoto)

3848e00e01
2016-09-24 14:03:14 -04:00
Justin M. Keyes
68bcb32ec4 tui.c: Do not wait for tui loop on teardown. (#4789)
Because terminfo_stop() already ran, there is not much reason to wait
for the loop to teardown.

Helped-by: Björn Linse <bjorn.linse@gmail.com>
Helped-by: oni-link <knil.ino@gmail.com>

Closes #4778
References #3541
---
Bug report:

> After pressing `ZZ` I can find two threads freezing, occupying 100% CPU:
    |-systemd-+
              |-nvim,11567 /home/lz/code/1.rs +set title
              |   `-{nvim},11574

> 11567 has two threads:
    (gdb) info threads
      Id   Target Id         Frame
    * 1    Thread 0x7f7622907780 (LWP 11567) "nvim" 0x00007f76222e66bd in pthread_join () from /usr/lib/libpthread.so.0
      2    Thread 0x7f761f5ff700 (LWP 11574) "nvim" 0x00007ffcec9e9c59 in clock_gettime ()

    (gdb) thread apply all  bt

    Thread 2 (Thread 0x7f761f5ff700 (LWP 11574)):
    #0  0x00007ffcec9e9c59 in clock_gettime ()
    #1  0x00007f76210b9356 in clock_gettime () from /usr/lib/libc.so.6
    #2  0x00007f7622513e3c in ?? () from /usr/lib/libuv.so.1
    #3  0x00007f7622505e94 in uv_run () from /usr/lib/libuv.so.1
    #4  0x00000000004822ed in loop_close (loop=loop@entry=0x7f761f5fe870) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/event/loop.c:87
    #5  0x00000000005a7ec0 in tui_main (bridge=0x7f761f6ac000, ui=0x7f761f69ace0) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/tui/tui.c:234
    #6  0x00000000005a9b47 in ui_thread_run (data=<optimized out>) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/ui_bridge.c:87
    #7  0x00007f7622510d07 in ?? () from /usr/lib/libuv.so.1
    #8  0x00007f76222e5474 in start_thread () from /usr/lib/libpthread.so.0
    #9  0x00007f76210ac69d in clone () from /usr/lib/libc.so.6

    Thread 1 (Thread 0x7f7622907780 (LWP 11567)):
    #0  0x00007f76222e66bd in pthread_join () from /usr/lib/libpthread.so.0
    #1  0x00007f7622510dae in uv_thread_join () from /usr/lib/libuv.so.1
    #2  0x00000000005aac9e in ui_bridge_stop (b=0x7f761f6ac000) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/ui_bridge.c:104
    #3  0x00000000005a90e4 in ui_builtin_stop () at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/ui.c:91
    #4  0x000000000052be09 in mch_exit (r=r@entry=1) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/os_unix.c:143
    #5  0x00000000004db1cc in getout (exitval=exitval@entry=1) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/main.c:623
    #6  0x00000000004fa43c in preserve_exit () at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/misc1.c:2652
    #7  0x000000000052b77a in deadly_signal (signum=1) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/os/signal.c:120
    #8  0x000000000052b7cf in on_signal (handle=<optimized out>, signum=<optimized out>, data=<optimized out>) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/os/signal.c:145
    #9  0x0000000000484178 in signal_event (argv=<optimized out>) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/event/signal.c:44
    #10 0x0000000000483b7f in queue_process_events (queue=0x7f7620417360) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/event/queue.c:142
    #11 0x0000000000482208 in loop_poll_events (loop=0x84dec0 <loop>, ms=ms@entry=4000) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/event/loop.c:56
    #12 0x000000000052a364 in input_poll (ms=ms@entry=4000) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/os/input.c:325
    #13 0x000000000052a3e2 in inbuf_poll (ms=4000) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/os/input.c:347
    #14 0x000000000052a839 in os_inchar (buf=buf@entry=0x0, maxlen=maxlen@entry=0, ms=ms@entry=-1, tb_change_cnt=tb_change_cnt@entry=0) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/os/input.c:107
    #15 0x0000000000592eeb in state_enter (s=s@entry=0x7ffcec9d3560) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/state.c:46
    #16 0x0000000000508533 in normal_enter (cmdwin=cmdwin@entry=false, noexmode=noexmode@entry=false) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/normal.c:464
    #17 0x00000000004dc17e in main (argc=<optimized out>, argv=<optimized out>) at /tmp/yaourt-tmp-lz/aur-neovim-git/src/neovim-git/src/nvim/main.c:538
2016-09-24 15:32:01 +02:00
Justin M. Keyes
e65895941c doc/deprecated.txt (#5338)
`deprecated.txt` is a place for deprecated tags to live.
- Encourages aggressive documentation of deprecations without cluttering
  the main help files.
- Provides a single browsable reference of all deprecations.

Other changes:
- Move tags to doc/vim_diff.txt.
- Remove doc/quotes.txt. It has little historical value, except maybe the
  Larry Wall quote.
2016-09-24 15:07:49 +02:00
James McCoy
54d41ff049 runtest.vim: Fix spelling of s:flaky 2016-09-23 14:39:10 -04:00
James McCoy
b9da0bd2c5 Merge branch 'jamessan/vim-019b9c6' 2016-09-23 11:34:58 -04:00
James McCoy
dabf009283 vim-patch:019b9c6
Add new test file.

019b9c644e

The file was already added in 8c1fb99d2d.
This commit just informs vim-patch.sh about the inclusion.

[ci skip]
2016-09-23 11:28:38 -04:00
Justin M. Keyes
e6d32c1010 ci: .travis.yml: Upgrade to macOS 10.11 / xcode7.3 (#5378)
Update to a recent, but not bleeding-edge, version of macOS and xcode.
At present, travis defaults to OS X 10.9.5 / Xcode 6.1.
QuickBuild runs macOS 10.10.
2016-09-23 17:06:54 +02:00
Justin M. Keyes
3c53371b0c Merge #4972 from justinmk/schedule-ui_refresh
Schedule ui_refresh
2016-09-23 12:31:05 +02:00
Justin M. Keyes
b94891421a ui_detach: Schedule refresh on main loop.
Closes #4163
2016-09-22 20:04:32 +02:00
Justin M. Keyes
e54c0ab367 test: api_spec
This is an (unsuccessful) attempt to cover #4163.
It covers other behavior, so it's worth keeping.
2016-09-22 20:04:32 +02:00
James McCoy
7307096c5e Merge pull request #5369 from jamessan/vim-patch-preprocessing
vim-patch: Group alternations in preprocess_patch
2016-09-22 08:11:13 -04:00
James McCoy
9d170a493e vim-patch: Group alternations in preprocess_patch
Without the groupings, only the first alternation matches the diff
marker.  For example,

    local na_doc='todo\.txt\|version\d\.txt\|tags'
    ... +'g^diff --git a/runtime/doc/'${na_doc}'...

becomes, after expansion,

    ... +'g^diff --git a/runtime/doc/todo\.txt\|version\d\.txt\|tags'...

so the matches become "^diff --get a/runtime/doc/todo\.txt",
"version\d\.txt", or "tags".  Adding the grouping ensures the expected
behavior of requiring "^diff --get a/runtime/doc/" before every
filename.
2016-09-22 07:16:50 -04:00
James McCoy
e2ad3fbf27 runtest.vim: Fix spelling of (s:)messages 2016-09-21 15:39:18 -04:00
Nova
a20a00459c vim-patch:7.4.1740
Problem:    syn-cchar defined with matchadd() does not appear if there are no
            other syntax definitions which matches buffer text.
Solution:   Check for startcol. (Ozaki Kiichi, haya14busa, closes vim/vim#757)

4d58502202
2016-09-22 01:46:30 +07:00
James McCoy
66fa1538ed Merge pull request #5368 from jamessan/vim-7.4.1309
vim-patch:7.4.1309
2016-09-21 13:04:36 -04:00
James McCoy
7063dd9d64 vim-patch:7.4.1309
Problem:    When a test fails not all relevant info is listed.
Solution:   Add the errors to the messages.

00af60bbb6

7.4.1309 was incorrectly marked as applied in #4301.  7.4.1477 relies on
some of the changes that had been made in 7.4.1309, so this fixes the
build after I, pre-emptively, merged #5038.
2016-09-21 12:09:41 -04:00
James McCoy
6cf24be295 Merge pull request #5038 from prollings/vim-7.4.1477
vim-patch:7.4.1477
2016-09-21 10:06:22 -04:00
Anatolii Sakhnik
baf91a455c l10n: Update Ukrainian translation (#5343) 2016-09-20 18:43:26 -04:00
Justin M. Keyes
bba6315580 Merge #5362 from justinmk/testcleanup
test: helpers.rmdir(): retry+sleep on failure
2016-09-20 12:32:42 +02:00
Justin M. Keyes
911421d328 test: legacy/012_directory_spec: Also use dot-prefix on Windows.
win32 handles dot-prefixed files just fine; Nvim-on-Windows does not
perpetuate the Vim-on-Windows behavior of avoiding dot-prefixed files.
2016-09-20 11:08:14 +02:00
Justin M. Keyes
13e5724621 test/helpers.rmdir(): lfs.rmdir() instead of os.remove()
os.remove() fails on empty directories in non-POSIX systems.
https://github.com/keplerproject/luafilesystem/issues/4

lfs.rmdir() "usually" works, so use it instead.

Closes #5236
2016-09-20 11:08:14 +02:00
Justin M. Keyes
764f576d64 test/helpers.rmdir(): Retry once after a delay.
Attempt to avoid "Permission denied" on Windows potentially caused by open
filepath handle in sibling process.
2016-09-20 11:08:14 +02:00
James McCoy
efe8311371 Merge pull request #4739 from brcolow/vim-7.4.1266
vim-patch 7.4.1266
2016-09-18 20:34:18 -05:00
Michael Ennen
8c24592da2 vim-patch 7.4.1266
Problem:    A BufAdd autocommand may cause an ml_get error (Christian
            Brabandt)
Solution:   Increment RedrawingDisabled earlier.

ab9fc7e0cf
2016-09-18 20:49:09 -04:00
Jurica Bradaric
7bf0cfb01f vim-patch:7.4.1670
Problem:    Completion doesn't work well for a variable containing "vim/vim#".
Solution:   Recognize the "vim/vim#". (Watiko)

a32095fc8f
2016-09-18 17:26:39 +02:00
Lucas Hoffmann
4a6b4bbf93 tests: migrate legacy test 12. #4196 2016-09-18 16:38:10 +02:00
Shougo Matsushita
7b6786f6f9 version.c: mark NA patches #5335
NA

2108: test_Netbeans
2114: tiny
2116: dosinst.c
2118: Tiny
2122: FEAT_CLIPBOARD
2129, 2130: timer
2131: channel
2133: Tiny
2138: if_py_both
2140: Tiny
2145, 2150: Win32
2153: GUI test
2154: Test_commnunicate()
2155: GUI test
2156: Win32
2157: test_job
2166, 2167: small build
2168: Makefile
2176: if_mzch
2182: term.c
2186: test_timers
2191, 2192: prototype
2193: GUI
2195: vimrun
2199: GUI
2202: small
2203: normal features
2206: ifdef
2207: xpm support feature
2210: configure
2211: mouse
2214: GUI
2216: test check sign feature
2218, 2234: ifdef
2238: term.c
2243: GUI
2247: ifdef
2252, 2253: GUI
2254: if_mzch
2257: if_python
2258, 2260: channel
2261: small
2262: viminfo
2267: Windows
2270: channel
2271: Netbeans
2281: timer
2282: mch_newshellsize()
2285: proto, Makefile
2286: Filelist, Makefile
2287: channel
2288: Windows
2289: Makefile
2290: FEAT_FLOAT
2297, 2298, 2301: channel
2302: Makefile
2304: timer
2308: Makefile
2310: timer
2316: channel
2325: Tiny
2327: channel
2332: timer
2338: small
2340: Makefile
2342: Windows
2344: channel
2345: Makefile
2351: test_Netbeans
2352: Makefile
2358: GUI
2359, 2361: timer
2363: regexp prototype
2365: Makefile, version8.txt, style
2366: bigvim.bat

Implemented

2213: EndOfBuffer
2016-09-18 13:52:07 +02:00
Justin M. Keyes
c12801986c Merge #5254 from KillTheMule/vim-7.4.1952
vim-patch:7.4.{1952, 1990, 2033, 2284}
2016-09-18 13:49:39 +02:00
Shougo Matsushita
e1079c2a28 insert_enter: Update folds on insert-leave. #5351
Fixes failing test: 045_folding_spec.lua
References #5299
2016-09-18 13:40:50 +02:00
Justin M. Keyes
19b47b043d eval.c: Clean up spurious FAIL checks. (#5345)
rettv_list_alloc cannot fail.
2016-09-18 13:18:45 +02:00
KillTheMule
89a7a4f02c vim-patch:7.4.2284
Problem:    Comment in scope header file is outdated. (KillTheMule)
Solution:   Point to the help instead. (closes vim/vim#1017)

f4145d8e99
2016-09-17 16:47:21 +02:00
Justin M. Keyes
dc6cc4787c api: Establish API naming convention. (#5344)
old name:                   new name:
  --------------------------------------------------
  nvim_name_to_color          nvim_get_color_by_name
  nvim_get_current_buffer     nvim_get_current_buf
  nvim_get_current_window     nvim_get_current_win
  nvim_get_buffers            nvim_list_bufs
  nvim_get_tabpages           nvim_list_tabpages
  nvim_get_windows            nvim_list_wins
  nvim_set_current_buffer     nvim_set_current_buf
  nvim_set_current_window     nvim_set_current_win
  nvim_change_directory       nvim_set_current_dir
  nvim_tabpage_get_window     nvim_tabpage_get_win
  nvim_tabpage_get_windows    nvim_tabpage_list_wins
  nvim_win_get_buffer         nvim_win_get_buf
  nvim_report_error           nvim_err_writeln

Helped-by: Björn Linse <bjorn.linse@gmail.com>
Helped-by: ZyX <kp-pav@yandex.ru>
Helped-by: James McCoy <jamessan@jamessan.com>
2016-09-17 06:30:36 +02:00
Justin M. Keyes
3a9da803cc Merge #5326 'vim-patch:7.4.1547' 2016-09-17 06:18:28 +02:00
Stéphane Campinas
21eee40cdb test: synIDattr returns empty, not -1
- Behavior changed in 7.4.1547
- Also removed N/A specs: nvim does not support ":hi term=..."
2016-09-16 14:02:59 +02:00
Stéphane Campinas
bc1a5db6cc vim-patch:7.4.1547 #5326
Problem:    Getting a cterm highlight attribute that is not set results in the
            string "-1".
Solution:   Return an empty string. (Taro Muraoka)

385111bd86
2016-09-16 14:00:10 +02:00
Shougo
6e9f329d05 perf: Skip foldUpdate() in insert-mode. #5299
Closes #5270
2016-09-16 01:19:36 +02:00
Kerem Cakirer
0c536b5d8a syntax.c: Support bg/fg special color-names. #5319
Refresh colors if changing Normal group
2016-09-16 00:45:57 +02:00
Björn Linse
c4199d1866 Merge pull request #5336 from bfredl/del_var
make del_var and set_var not return the old value.
2016-09-15 20:41:16 +02:00
Björn Linse
cd08e6cf72 api: make nvim[_obj]_set_var and _del_var not return the old value 2016-09-15 10:44:38 +02:00
Björn Linse
c61bf43a90 gendispatch: warn for deprecated alias if the deprecated function has implemation 2016-09-15 10:44:38 +02:00
James McCoy
fee961c8dd Merge #5339 from jamessan/stray-test-processes
test/ui: Stop the terminal job after testing
2016-09-14 21:36:17 -04:00
James McCoy
c28fb221ba Restore output_spec assertion dropped in f332eba 2016-09-14 20:59:09 -04:00
James McCoy
df99e43ba4 tests/ui: Stop the terminal job after testing
When running the tests in a contained environment, the lingering
terminal processes prevent the unmounting of the filesystems in the
contained environment.
2016-09-14 20:56:47 -04:00
Björn Linse
5f42184873 api: remove unnecessary initializations causing warnings in api dispatch (#5337)
Left over change from acb7c82 (fix leak when a api function is
incorrectly called with a list.). These initializations are now never
used and causes warnings in static analysis
2016-09-14 13:10:04 +02:00
Justin M. Keyes
172d099c32 Merge #5329 from justinmk/remove-misc2
Eliminate misc2.c
2016-09-13 17:23:35 +02:00
Justin M. Keyes
ca93b4a299 read_string: Use char if you mean char. 2016-09-13 16:20:09 +02:00
Justin M. Keyes
df072c3b2b refactor: eliminate misc2.c
move `call_shell` to misc1.c
Move some fns to state.c
Move some fns to option.c
Move some fns to memline.c
Move `vim_chdir*` fns to file_search.c
Move some fns to new module, bytes.c
Move some fns to fileio.c
2016-09-13 16:20:09 +02:00
Justin M. Keyes
7eb4d2f79d vim-patch:7.4.1558 (#5333)
Problem:    It is not easy to find out what windows display a buffer.
Solution:   Add win_findbuf().

9cdf86b86f
2016-09-13 14:05:34 +02:00
Justin M. Keyes
a34d3a7244 Merge 'vim-patch.sh' 2016-09-13 12:50:31 +02:00
Justin M. Keyes
d61826a85c vim-patch.sh: Use printf instead of echo
Also: neovim => nvim
2016-09-13 12:40:20 +02:00
Justin M. Keyes
d5aaa18316 vim-patch.sh: preprocess_patch()
- Remove not-applicable Vim changes such as *.proto, todo.txt, ...

Also:
- support NVIM_SOURCE_DIR override
2016-09-13 11:38:09 +02:00
Justin M. Keyes
2daf54ee8d Merge #4874 'Restore vim-like tab dragging' 2016-09-12 03:43:07 +02:00
Justin M. Keyes
ac819b8994 CI: Travis macOS: Skip tab left-drag tests.
These tests fail on master, so it's not a regression. Changes in #4874
(parent commit) seem to work (and pass most CI), so skipping these tests
is better than blocking the changes.
2016-09-12 03:42:51 +02:00
Justin M. Keyes
b801291bec CI: test: Avoid QuickBuild hang. (#5330)
Delete the CWD using nvim instead of the external lua/test runner process.
2016-09-12 03:18:48 +02:00
sach1t
c6f5d6b7e0 normal.c: Restore vim-like tab dragging. #4874
Closes #4663
References #3310
2016-09-12 03:11:26 +02:00
Anmol Sethi
4ceacb37d5 man.vim: prevent bell in ':wincmd w' when only one window (#5328) 2016-09-11 20:58:51 +02:00
davix
13db9236fe vim-patch:7.4.1535 (#5327)
Problem:    The feedkeys test has a one second delay.
Solution:   Avoid need_wait_return() to delay. (Hirohito Higashi)

9e496854a9
2016-09-11 15:16:36 +02:00
Wei Huang
c4c2969624 vim-patch:7.4.1533 #5320
Problem:    Using feedkeys() with an empty string disregards 'x' option.
Solution:   Make 'x' work with an empty string. (Thinca)

When integrating the patch to nvim, used same logic but different code
based on nvim codebase. New test passed.

74c5bbf134
2016-09-11 03:47:16 +02:00
Justin M. Keyes
ca65514a24 Merge #2789 'system(): Respect shellxescape, shellxquote' 2016-09-11 03:27:35 +02:00
Justin M. Keyes
395ef5642e shell_escape: rename; refactor
- rename to shell_xescape_xquote
- move to os/shell.c
- disallow NULL argument
- eliminate casts, nesting
- test: empty shellxquote/shellxescape
2016-09-11 03:04:57 +02:00
Justin M. Keyes
8dc6c1a7ff Merge #5318 from equalsraf/fix-openbsd
Fix OpenBSD builds
2016-09-10 23:36:25 +02:00
Zhaosheng Pan
0991041ae7 system(): Respect 'sxe' and 'sxq' #2789
Fixes #2773
2016-09-10 22:21:40 +02:00
Rui Abreu Ferreira
0ebd30fba7 third-party: Bump luv to v1.9.1-0
Fixes #4620
2016-09-10 18:43:05 +01:00
Rui Abreu Ferreira
aa6705875d Add compiler check for -Wno-static-in-inline
Add compiler check for -Wno-static-in-inline, the option is only
supported in gcc >= 4.4, and some systems still ship with earlier
versions of gcc (see #5300).
2016-09-10 18:43:04 +01:00
Rui Abreu Ferreira
4c9e5676cd Disable use of jemalloc in OpenBSD
Works around #3434, turning off the use of jemalloc in OpenBSD.
2016-09-10 18:43:04 +01:00
Justin M. Keyes
bccb49bedb Merge #5316 2016-09-10 14:11:12 +02:00
oni-link
f8a8a56908 eval.c: Fix memory leak for detached pty job 2016-09-08 21:29:20 +02:00
oni-link
1c9d7270a8 eval.c: Garbage collection frees dictionary before job cleanup
Removing a job too early from the joblist gives garbage collection the
chance to also remove the job dictionary.

Can be triggered with ASAN while waiting 'updatetime'ms (~5 seconds)
before closing the terminal window opened with:

    nvim -u NONE +'call termopen("true",{})'
2016-09-08 21:29:20 +02:00
Justin M. Keyes
fe06e2a4a0 doc 2016-09-06 03:43:13 -04:00
Justin M. Keyes
d9d2c2fcc0 doc: clarify reltime()
Closes #5301
2016-09-05 20:15:31 -04:00
Justin M. Keyes
df99c6493d health.vim: "No healthchecks found" also needs the buffer. 2016-09-05 19:42:28 -04:00
Justin M. Keyes
522b885a0d Merge #5295 'health.vim' 2016-09-05 19:34:00 -04:00
Justin M. Keyes
3c24704ac8 health.vim: Show results incrementally.
Also:

- improve precision of "No healthcheck found"
- fix SUGGESTIONS syntax group definition
- fix indentation of SUGGESTIONS
2016-09-05 19:22:01 -04:00
Justin M. Keyes
31257b450b health.vim: Factor out health#provider#check() 2016-09-05 18:29:47 -04:00
Alex Genco
d61a50758c Improve Ruby version check in CheckHealth command
Compare current version number to that of the latest released neovim
rubygem, rather than a hard-coded version.

Note: The `gem list` command introduced here adds about 4 seconds to the
execution time of the CheckHealth command.
2016-09-04 21:26:21 -07:00
ZyX
6127eaef05 shada: Fix non-writeable ShaDa directory handling
Before this change,

    nvim -i /etc/shada

segfaults on exit if the file does not exist and user does not have
permissions to create the file at /etc/shada.

Closes #5296
Reported in #5277
https://github.com/neovim/neovim/issues/5277#issuecomment-243937255
2016-09-04 21:45:48 -04:00
HiPhish
cd321b7d0f getcwd(): Return empty string if CWD is invalid. #5292
Closes #5291

Restores behaviour identical to Vim. If the user calls the VimScript
function 'getcwd()' and the working directory cannot be found (for
example because the directory has been deleted since the last time it
was used) an empty string needs to be returned instead of throwing an
error.
2016-09-04 08:01:31 -04:00
Jurica Bradarić
73b8424fad vim-patch:7.4.1913 (#5260)
Problem:    When ":doautocmd" is used modelines are used even when no
            autocommands were executed. (Daniel Hahler)
Solution:   Skip processing modelines. (closes vim/vim#854)

1610d05241
2016-09-04 23:43:41 +02:00
Jurica Bradarić
0f381f26cb vim-patch:7.4.1971 (#5262)
Problem:    It is not easy to see unrecognized error lines below the current
            error position.
Solution:   Add ":clist +count".

e8fea0728a
2016-09-04 23:40:12 +02:00
Kalle Ranki
e75e9c10dc test: Add unittest spec for option.c (#5289)
Move typedef expand_T to types.h for tests
Fix lint error for old style comments

Describe 'check_ff_value' valid values as an initial test.

Fix 'get_sts_value' comment inaccuracy and add unit test for it
2016-09-04 09:54:41 +02:00
Anmol Sethi
9bba8ba372 [RFC] man.vim: remove <Plug> mappings (#5290)
- :Man with no arguments opens the manapage for the
  <cWORD> (man buffers) or <cword> (non-man buffers).
- remove now irrelevent comment about -P flag
2016-09-04 03:53:58 +02:00
Alejandro Sanchez
626065d385 tchdir: New tab should inherit CWD. (#5227)
When a new tabpage gets created it will copy the local working directory
of the previous one, if there is any.
2016-09-04 03:40:01 +02:00
Jurica Bradarić
5d8d24f0c2 vim-patch:7.4.1900 (#5259)
Problem:    Using CTRL-] in the help on "{address}." doesn't work.
Solution:   Recognize an item in {}. (Hirohito Higashi, closes vim/vim#814)

28b942a064
2016-09-04 03:30:36 +02:00
Nicolas Hillegeer
a9c5423263 signal_init: unblock all signals on startup. #5283
As discussed on #5243 and #5283.

Helped-by: John Szakmeister <john@szakmeister.net>
Helped-by: Justin M. Keyes <justinkz@gmail.com>
2016-09-03 19:16:23 -04:00
Justin M. Keyes
2f6d3e599b Merge #5249 'man.vim' 2016-09-03 14:01:04 -04:00
Justin M. Keyes
c9e39f8227 man.vim: Avoid hard redraw.
Use system() instead of :read to avoid a hard redraw.
2016-09-03 13:59:37 -04:00
Anmol Sethi
f8fc8f51c0 man.vim #5249
- fix synopsis highlighting in other locales. Cannot always rely on the first
  line for the section in some locales; instead, use the file path and
  explicitly set b:man_sect to the actual section.
- eliminate separate s:man_args function
- simplify logic: do not reuse buffer content
- introduce b:man_default_sects Fixes #5233
- introduce <Plug>(man_vsplit), <Plug>(man_tab)
- simplify regexps
2016-09-03 12:57:41 -04:00
James McCoy
94dfb6cea2 Merge pull request #5286 from jamessan/strtoimax-error-checking
Fix error-handling of strtoimax boundary conditions
2016-09-03 00:55:27 -04:00
Patrick Jackson
0253766b5d lint: Close resource leak (#5288) 2016-09-03 00:41:55 +02:00
James McCoy
a371f1027e Fix error-handling of strtoimax boundary conditions
strtoimax is only required to set errno if there is an
underflow/overflow.  In those conditions, strtoimax returns
INTMAX_MIN/INTMAX_MAX respectively, so that's the only time we should be
checking the value of errno.

Even in those conditions, errno needs to be set to a known good value
before calling strtoimax to differentiate between "value is actually
INTMAX_MAX/MIN" and "value over/underflows".

Closes #5279
2016-09-02 10:11:32 -04:00
oni-link
f175b281cf helpers.c: Fix invalid state of failed conversion result for object_to_vim() (#5282)
If a conversion for a container fails in object_to_vim(), the memory for
the container in the returned/converted value is freed, but the returned
value keeps a pointer to the freed memory. Calling later clear_tv() on
this value leads to an invalid memory access.

Set v_type to VAR_UNKNOWN in the converted value on failure, so that
clear_tv() has no effect.
2016-09-01 23:52:58 +02:00
Björn Linse
c6ac4f84b1 Merge pull request #4934 from bfredl/api
make the API callable from vimL, rename API functions to common nvim_ prefix
2016-09-01 18:32:37 +02:00
Björn Linse
acb7c826b3 api: fix leak when a api function is incorrectly called with a list.
This applies both to msgpack-rpc and eval.
2016-08-31 21:57:06 +02:00
Björn Linse
98a08c3e5a api: add tests for calling the api from vimscript 2016-08-31 21:57:06 +02:00
Björn Linse
1c22cab2fd api: consistently use nvim_ prefix and update documentation 2016-08-31 21:57:06 +02:00
Björn Linse
e536abc1e1 api: Allow blacklist functions that shouldn't be accesible from eval
Blacklist deprecated functions and functions depending on channel_id
2016-08-31 21:57:06 +02:00
Björn Linse
7e2348f2b1 eval: use gperf to generate the hash of builtin functions
make api functions highlighted as builtins in vim.vim
2016-08-31 21:57:04 +02:00
Björn Linse
87e054bb24 api: When calling get/set_lines from vimL, don't convert between "\n" and "\0". 2016-08-31 21:40:20 +02:00
Björn Linse
a2d25b7bf8 api: unify buffer numbers and window ids with handles
also allow handle==0 meaning curbuf/curwin/curtab
2016-08-31 21:40:20 +02:00
Björn Linse
3bd3b3b768 api: auto generate api function wrappers for viml 2016-08-31 21:40:20 +02:00
Björn Linse
de3a515123 api: rename "msgpack_rpc/defs.h" to "api/private/dispatch.h" and use the header generator. 2016-08-31 21:40:20 +02:00
ZyX
5e59916e84 eval: Use generated hash to look up function list
Problems:
- Disables cross-compiling (alternative: keeps two hash implementations which
  need to be synchronized with each other).
- Puts code-specific name literals into CMakeLists.txt.
- Workaround for lua’s absence of bidirectional pipe communication is rather
  ugly.
2016-08-31 21:40:20 +02:00
Björn Linse
abe00d583e eval: add new function entries 2016-08-31 21:40:20 +02:00
ZyX
8fb7273ac0 eval: Move VimL functions list to a lua file
Removes all kinds of problems with sorting, provides a ready-to-use function
list representation for genvimvim.lua, does not require specifying function name
twice (VimL function name (string) + f_ function name).
2016-08-31 21:40:20 +02:00
Björn Linse
0ade1bb706 Merge pull request #5225 from equalsraf/windows-functionaltests
Enable functional tests in Appveyor
2016-08-31 21:39:42 +02:00
Rui Abreu Ferreira
9ce81f7b2b functionaltest: Create lua helper for os.tmpname()
In Windows Lua's os.tmpname() returns relative paths starting with \s,
prepend them with $TEMP to generate a valid path.

In OS X os.tmpname() returns paths in '/tmp' but they should be in
'/private/tmp'. We cannot use os_name() for platform detection because
some tests use tempname() before nvim is spawned, instead use one of the
following:

1. Set SYSTEM_NAME environment variable before calling the tests, it
   is set from CMAKE_SYSTEM_NAME(i.e. uname -s or 'Windows')
2. Call uname -s
3. Assume windows
2016-08-31 11:32:28 +01:00
Jurica Bradarić
7fd771619f vim-patch:7.4.1896 (#5258)
Problem:    Invoking mark_adjust() when adding a new line below the last line
            is pointless.
Solution:   Skip calling mark_adjust() when appending below the last line.

82faa259cc
2016-08-29 14:35:48 -04:00
Justin M. Keyes
10a54ad12e signal_init: Always unblock SIGCHLD. (#5243)
Inherited signal mask may block SIGCHLD, which causes libuv to hang at
epoll_wait.

Closes #5230

Helped-by: Nicolas Hillegeer <nicolas@hillegeer.com>
Helped-by: John Szakmeister <john@szakmeister.net>

Note: the #pragma gymnastics are a workaround for broken system headers on
macOS.

  signal.h:
      int  sigaddset(sigset_t *, int);
      #define     sigaddset(set, signo)   (*(set) |= __sigbits(signo), 0)
  sys/_types/_sigset.h:
      typedef __darwin_sigset_t            sigset_t;
  sys/_types.h:
      typedef __uint32_t   __darwin_sigset_t;      /* [???] signal set */

sigset_t is defined as unsigned int, but the sigaddset() ORs it with an int,
mixing the types.  So GCC generates a sign-conversion warning:

  sig.c:9:13: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]
    (*(&s) |= __sigbits((sigset_t) 20), 0);
           ~~ ^~~~~~~~~~~~~~~~~~~~~~~~
  1 warning generated.

System headers are normally ignored when the compiler generates warnings:
https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html

  > GCC gives code found in system headers special treatment. All warnings,
  > other than those generated by ‘#warning’ (see Diagnostics), are suppressed
  > while GCC is processing a system header. Macros defined in a system header
  > are immune to a few warnings wherever they are expanded. This immunity is
  > granted on an ad-hoc basis, when we find that a warning generates lots of
  > false positives because of code in macros defined in system headers.

Instead of the #pragma workaround, we could cast the sigset_t pointer:

    # if defined(__APPLE__)
      sigaddset((int *)&mask, SIGCHLD);
    # else
      sigaddset(&mask, SIGCHLD);
    # endif

but that could break if the headers are later fixed.
2016-08-29 13:39:32 -04:00
Björn Linse
0b5a7e4ad5 Merge pull request #4432 from bfredl/pum_ui
allow external UI:s to render the popupmenu
2016-08-29 11:00:24 +02:00
Björn Linse
8d6e3f2b88 api/ui: add documentation for remote ui redraw events 2016-08-29 10:17:31 +02:00
Björn Linse
c41bacc67c api/ui: add tests for popupmenu_external events
update screen.lua to use new style nvim_ui_attach
2016-08-29 10:17:31 +02:00
Björn Linse
e968d72cae api/ui: use ui options instead of one method per feature
Use new nvim_ui_ prefix to avoid breaking change.
2016-08-29 10:17:31 +02:00
Björn Linse
999af47be8 api/ui: allow popupmenu to be drawn by external ui 2016-08-29 10:17:31 +02:00
KillTheMule
0b3ec84840 Add if_cscope documentation for querytype 'a'
From 802a0d902fca423acb15f835d7b09183883d79a0.
2016-08-26 22:13:56 +02:00
KillTheMule
e587b490a0 Lint 2016-08-26 21:50:19 +02:00
KillTheMule
59468e3495 vim-patch:7.4.2033
Problem:    'cscopequickfix' option does not accept new value "a".
Solution:   Adjust list of command characters. (Ken Takata)

6d20e17544

All changes applied manually. Definition of `CSQF_CMDS` was moved to
`option_defs.h` in nvim.
2016-08-26 21:50:19 +02:00
KillTheMule
1995be8451 vim-patch:7.4.1990
Problem:    Cscope items are not sorted.
Solution:   Put the new "a" command first. (Ken Takata)

80632db65e

All changes applied manually.
2016-08-26 21:50:19 +02:00
KillTheMule
86a95c5117 vim-patch:7.4.1952
Problem:    Cscope interface does not support finding assignments.
Solution:   Add the "a" command. (ppettina, closes vim/vim#882)

b12e7ef956

All changes applied manually.
2016-08-26 21:50:18 +02:00
Justin M. Keyes
97c6d80ca7 release.sh: Sign the tag.
Also: hacks for BSD sed.
2016-08-26 03:51:52 -04:00
Rui Abreu Ferreira
39c628d031 Mark some functional tests as pending in Windows 2016-08-26 08:21:41 +01:00
Rui Abreu Ferreira
0089ef6b65 Appveyor: Enable functional tests
Most functional tests don't work on Windows yet, for now enable a subset of the tests in Appveyor builds.
2016-08-26 08:21:41 +01:00
Rui Abreu Ferreira
703cf3197f third-party: Windows fix for luv build recipe
The argument quotes in the luv build recipe did not work
in Windows.
2016-08-26 08:09:56 +01:00
Rui Abreu Ferreira
bed61041a0 third-party: Build busted in Windows
Busted now builds on Windows, remove the check. In Windows the binary
is called busted.bat.
2016-08-26 08:09:56 +01:00
Michael Ennen
9da4d0dfee Update to libuv 1.9.1 2016-08-26 08:09:56 +01:00
Rui Abreu Ferreira
eb2d547bd5 build: Refactor appveyor/Windows scripts (#5244)
- Join all msys build scripts into one
- Clean up appveyor.yml and generate installer for tagged builds

A side effect of the cosmetic changes is that appveyor artifact
permalinks are easier to use, e.g. for the latest zip in the
master branch

    https://ci.appveyor.com/api/projects/neovim/neovim/artifacts/build/Neovim.zip?branch=master&job=Configuration%3A%20MINGW_64
2016-08-26 01:38:46 -04:00
James McCoy
48dbb75ff6 iconv: Always include errno.h when USE_ICONV is defined (#5251)
When USE_ICONV is defined, iconv.h references various errno constants,
but errno.h is only being included when HAVE_ICONV_H is not defined.
This causes build failures on at least GNU/Hurd.
2016-08-25 22:02:40 -04:00
Justin M. Keyes
7bc627b3c8 Merge #5210 'vim-patch:7.4.1898 + :Man modifiers support'. 2016-08-25 21:54:00 -04:00
Justin M. Keyes
4af6ec746c Merge #5253 'perf: Disable clipboard in do_cmdline()' 2016-08-25 20:47:00 -04:00
Justin M. Keyes
7a589e4a9e lint 2016-08-25 20:36:59 -04:00
Björn Linse
41a64586c7 Merge pull request #5232 from bfredl/dictchar_u
eval: remove char_u in  get_dict_(string|number) key parameters
2016-08-25 19:16:03 +02:00
Justin M. Keyes
c826ebd3de perf: Disable clipboard in do_cmdline().
For any script--not just `:global` commands--there is no reason to
update the system clipboard until the script is finished, so disable it
during do_cmdline().

Before this change, 'clipboard=unnamedplus' causes scripted editing to
be extremely slow (e.g. `:normal` in a while-loop).

Closes #3534
2016-08-25 11:16:22 -04:00
Justin M. Keyes
c79bf4ec99 ops.c: Rename start_global_changes(). 2016-08-25 10:34:47 -04:00
Anmol Sethi
db2aa27df1 man.vim: if reusing a buffer, do not use noautocmd
The commit that added support for modifiers regressed #5168
causing #5172. This commit fixes it again.
2016-08-24 15:41:51 -04:00
Anmol Sethi
470883d705 man.vim: slight refactoring
Addresses problem one in #5240
2016-08-24 11:51:59 -04:00
Anmol Sethi
f5d3f3da6f use bool type for flag mod_entry_T members 2016-08-24 11:51:59 -04:00
Anmol Sethi
10b014ca7b man.vim: set window local options when reusing buffer
This is necessary incase the buffer was previously opened in a different
tab, in which the window options there do not carry over. It is not
explicitly documented in ':help local-options' but that is how it works.
2016-08-24 11:51:59 -04:00
Anmol Sethi
728d582333 man.vim: support for command modifiers
Closes #5235
2016-08-24 11:51:59 -04:00
Anmol Sethi
8a7b15cf35 vim-patch:7.4.1898
Problem:    User commands don't support modifiers.
Solution:   Add the <mods> item. (Yegappan Lakshmanan, closes vim/vim#829)

63a60ded3f
2016-08-24 11:51:59 -04:00
Björn Linse
6d8a509e51 eval: remove (char_u *) in constant get_dict_(string|number) parameters
Remove redundant item availibility checks when constructing
complete items from a dict.
2016-08-24 11:04:22 +02:00
Anmol Sethi
4d253b4df5 doc: CONTRIBUTING.md (#5239) 2016-08-23 23:49:09 -04:00
Justin M. Keyes
46475a1021 release.sh: Touch NVIM_VERSION_PATCH, show obnoxious message.
git-log-pretty-since.sh: fix bug
2016-08-22 15:39:14 -04:00
Justin M. Keyes
2f2e729899 Merge commit 'refs/pull/upstream/5156' 2016-08-22 02:47:10 -04:00
Justin M. Keyes
ad43480952 version bump 2016-08-22 00:28:47 -04:00
Tommy Allen
8d8af65659 Linting 2016-08-17 17:48:15 -04:00
Tommy Allen
605e74327a highlight: Added QuickFixLine highlight group
- Links to Search by default

screen.c: Combine CursorLine with QuickFixLine

- HLF_QFL takes priority over HLF_CUL

docs: Updated to mention QuickFixLine
runtime: Added QuickFixLine to nvimHLGroup
tests: QuickFixLine highlight
2016-08-17 17:48:15 -04:00
Patrick
a4cb500d98 vim-patch:7.4.1477
Problem:    Test_reltime is flaky, it depends on timing.
Solution:   When it fails run it a second time.

b5760a1ce5
2016-08-04 13:29:29 +10:00
383 changed files with 46501 additions and 85092 deletions

View File

@@ -2,7 +2,7 @@
:: MSYS2, this allows using all the dependencies and tools available
:: in MSYS2, but we cannot build inside the MSYS2 shell.
echo on
if "%TARGET%" == "MINGW_32" (
if "%CONFIGURATION%" == "MINGW_32" (
set ARCH=i686
set BITS=32
) else (
@@ -12,9 +12,12 @@ if "%TARGET%" == "MINGW_32" (
:: We cannot have sh.exe in the PATH (MinGW)
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
set PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH%
:: The default cpack in the PATH is not CMake
set PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH%
:: Build third-party dependencies
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" || goto :error
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-python2 mingw-w64-%ARCH%-diffutils" || goto :error
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-python2 mingw-w64-%ARCH%-diffutils gperf" || goto :error
mkdir .deps
cd .deps
@@ -22,6 +25,20 @@ cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..\third-party\ || goto :e
mingw32-make VERBOSE=1 || goto :error
cd ..
:: Build Neovim
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUSTED_OUTPUT_TYPE=gtest -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
mingw32-make VERBOSE=1 || goto :error
bin\nvim --version || goto :error
:: Functional tests
mingw32-make functionaltest VERBOSE=1 || goto :error
:: Build artifacts
cpack -G ZIP -C Release
if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C Release
goto :EOF
:error
exit /b %errorlevel%

View File

@@ -1,22 +0,0 @@
echo on
if "%TARGET%" == "MINGW_32" (
set ARCH=i686
set BITS=32
) else (
set ARCH=x86_64
set BITS=64
)
:: We cannot have sh.exe in the PATH (MinGW)
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
set PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH%
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release .. || goto :error
mingw32-make VERBOSE=1 || goto :error
bin\nvim --version || goto :error
cd ..
goto :EOF
:error
exit /b %errorlevel%

View File

@@ -9,9 +9,7 @@ env:
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
- MAKE_CMD="make -j2"
# Update PATH for pip.
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
# LLVM symbolizer path.
- LLVM_SYMBOLIZER="$(which llvm-symbolizer-3.4)"
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:/usr/lib/llvm-symbolizer-3.8/bin:$PATH"
# Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies.
@@ -36,9 +34,8 @@ env:
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
# Environment variables for Clang sanitizers.
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
- ASAN_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER"
- TSAN_OPTIONS="external_symbolizer_path=$LLVM_SYMBOLIZER log_path=$LOG_DIR/tsan"
- UBSAN_OPTIONS="log_path=$LOG_DIR/ubsan"
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
# Environment variables for Valgrind.
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
# Cache marker for third-party dependencies cache.
@@ -70,15 +67,17 @@ matrix:
compiler: gcc-5 -m32
env: BUILD_32BIT=ON
- os: linux
compiler: clang
compiler: clang-3.8
env: CLANG_SANITIZER=ASAN_UBSAN
- os: linux
compiler: clang
compiler: clang-3.8
env: CLANG_SANITIZER=TSAN
- os: osx
compiler: clang
osx_image: xcode7.3 # macOS 10.11
- os: osx
compiler: gcc-4.9
osx_image: xcode7.3 # macOS 10.11
fast_finish: true
before_install: .ci/before_install.sh
@@ -94,11 +93,12 @@ addons:
# TODO: Remove PPA when Travis gets Python >=3.3.
- deadsnakes
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- autoconf
- automake
- build-essential
- clang-3.4
- clang-3.8
- cmake
- g++-5-multilib
- g++-multilib
@@ -107,7 +107,7 @@ addons:
- gdb
- libc6-dev-i386
- libtool
- llvm-3.4-dev
- llvm-3.8-dev
- pkg-config
- python3.3-dev
- unzip

View File

@@ -8,6 +8,9 @@ endif()
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# We don't support building in-tree.
include(PreventInTreeBuilds)
# Prefer our bundled versions of dependencies.
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
@@ -56,12 +59,17 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Dev" "Release" "MinSizeRel" "RelWithDebInfo")
# If not in a git repo (e.g., a tarball) these tokens define the complete
# version string, else it is combined with the result of `git describe`.
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 1)
set(NVIM_VERSION_PATCH 5)
set(NVIM_VERSION_PATCH 7)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
# API level
set(NVIM_API_LEVEL 1) # Bump this after any API change.
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
set(NVIM_API_PRERELEASE false)
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
@@ -253,6 +261,10 @@ option(
if(TRAVIS_CI_BUILD)
message(STATUS "Travis CI build enabled.")
add_definitions(-Werror)
if(DEFINED ENV{BUILD_32BIT})
# Get some test coverage for unsigned char
add_definitions(-funsigned-char)
endif()
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
@@ -328,7 +340,12 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA
message(FATAL_ERROR "Sanitizers are only supported for Clang.")
endif()
option(ENABLE_JEMALLOC "enable jemalloc" ON)
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
message(STATUS "detected OpenBSD; disabled jemalloc. #5318")
option(ENABLE_JEMALLOC "enable jemalloc" OFF)
else()
option(ENABLE_JEMALLOC "enable jemalloc" ON)
endif()
if (ENABLE_JEMALLOC)
if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN)
@@ -395,7 +412,7 @@ endif()
message(STATUS "Using the Lua interpreter ${LUA_PRG}.")
# Setup busted.
find_program(BUSTED_PRG busted)
find_program(BUSTED_PRG NAMES busted busted.bat)
find_program(BUSTED_LUA_PRG busted-lua)
if(NOT BUSTED_OUTPUT_TYPE)
if(WIN32)
@@ -407,6 +424,8 @@ endif()
find_program(LUACHECK_PRG luacheck)
find_program(GPERF_PRG gperf)
include(InstallHelpers)
file(GLOB MANPAGES
@@ -498,6 +517,7 @@ if(BUSTED_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=unit
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${UNITTEST_PREREQS}
${TEST_TARGET_ARGS})
@@ -516,6 +536,7 @@ if(BUSTED_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS}
${TEST_TARGET_ARGS})
@@ -530,6 +551,7 @@ if(BUSTED_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=benchmark
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${BENCHMARK_PREREQS}
${TEST_TARGET_ARGS})
@@ -546,6 +568,7 @@ if(BUSTED_LUA_PRG)
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DBUILD_DIR=${CMAKE_BINARY_DIR}
-DTEST_TYPE=functional
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
DEPENDS ${FUNCTIONALTEST_PREREQS}
${TEST_TARGET_ARGS})
@@ -556,6 +579,7 @@ if(LUACHECK_PRG)
COMMAND ${CMAKE_COMMAND}
-DLUACHECK_PRG=${LUACHECK_PRG}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
-P ${PROJECT_SOURCE_DIR}/cmake/RunTestsLint.cmake)
endif()

View File

@@ -38,15 +38,25 @@ Pull requests ("PRs")
- Try to [tidy your history][git-history-rewriting]: combine related commits
with interactive rebasing, separate monolithic commits, etc.
### Stages: WIP, RFC
### Stages: WIP, RFC, RDY
Pull requests have two stages: `[WIP]` (Work In Progress) and `[RFC]` (Request
For Comment).
Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request
For Comment) and `[RDY]` (Ready).
- Untagged PRs are assumed to be `[RFC]`, i.e. the work is ready for review and
you would like feedback.
- Preprend `[WIP]` to the PR title if you are _not_ ready for feedback and the
- Untagged PRs are assumed to be `[RFC]`, i.e. you are requesting a review.
- Prepend `[WIP]` to the PR title if you are _not_ requesting feedback and the
work is still in flux.
- Prepend `[RDY]` to the PR title if you are _done_ with the PR and are only
waiting on it to be merged.
For example, a typical workflow is:
1. You open a `[WIP]` PR where the work is _not_ ready for feedback, you just want to
let others know what you are doing.
2. Once the PR is ready for review, you replace `[WIP]` in the title with `[RFC]`.
You may add fix up commits to address issues that come up during review.
3. Once the PR is ready for merging, you rebase/squash your work appropriately and
then replace `[RFC]` in the title with `[RDY]`.
### Commit messages

View File

@@ -1,20 +1,24 @@
![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo.png)
[![Neovim](https://raw.githubusercontent.com/neovim/neovim.github.io/master/logos/neovim-logo.png)](https://neovim.io)
[Website] | [Community] | [Wiki] | [Documentation] | [Mailing List] | [Twitter] | [Bountysource]
[Wiki](https://github.com/neovim/neovim/wiki) |
[Documentation](https://neovim.io/doc) |
[Twitter](https://twitter.com/Neovim) |
[Community](https://neovim.io/community/) |
[Gitter **Chat**](https://gitter.im/neovim/neovim)
[![Travis Build Status](https://travis-ci.org/neovim/neovim.svg?branch=master)](https://travis-ci.org/neovim/neovim)
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/cf1jwc29198748we/branch/master?svg=true)](https://ci.appveyor.com/project/neovim/neovim/branch/master)
[![Pull requests waiting for review](https://badge.waffle.io/neovim/neovim.svg?label=RFC&title=RFCs)](https://waffle.io/neovim/neovim)
[![Coverage Status](https://img.shields.io/coveralls/neovim/neovim.svg)](https://coveralls.io/r/neovim/neovim)
[![Coverity Scan Build](https://scan.coverity.com/projects/2227/badge.svg)](https://scan.coverity.com/projects/2227)
[![Clang Scan Build](http://neovim.io/doc/reports/clang/badge.svg)](http://neovim.io/doc/reports/clang)
[![Gitter chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/neovim/neovim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Clang Scan Build](https://neovim.io/doc/reports/clang/badge.svg)](https://neovim.io/doc/reports/clang)
<a href="https://buildd.debian.org/neovim"><img src="https://www.debian.org/logos/openlogo-nd-25.png" width="13" height="15">Debian</a>
Neovim is a project that seeks to aggressively refactor Vim in order to:
- Simplify maintenance and encourage [contributions](CONTRIBUTING.md)
- Split the work between multiple developers
- Enable the implementation of new/modern UIs without modifications to the core
- Enable advanced [external UIs] without modifications to the core
- Improve extensibility with a new [plugin architecture](https://github.com/neovim/neovim/wiki/Plugin-UI-architecture)
For more details, see
@@ -45,7 +49,7 @@ See the [Roadmap].
How do I get it?
----------------
There is a formula for OSX/homebrew, a PKGBUILD for Arch Linux, RPM, deb, and
There is a Debian package, homebrew formula, PKGBUILD for Arch Linux, RPM, and
more. See [the wiki](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
License
@@ -74,15 +78,9 @@ See `LICENSE` for details.
You can also sponsor the development of Vim. Vim sponsors can vote for
features. The money goes to Uganda anyway.
[Website]: http://neovim.io
[Community]: http://neovim.io/community/
[Wiki]: https://github.com/neovim/neovim/wiki
[Documentation]: http://neovim.io/doc
[Mailing List]: https://groups.google.com/forum/#!forum/neovim
[Twitter]: http://twitter.com/Neovim
[Bountysource]: https://www.bountysource.com/teams/neovim
[license-commit]: https://github.com/neovim/neovim/commit/b17d9691a24099c9210289f16afb1a498a89d803
[nvim-features]: https://neovim.io/doc/user/vim_diff.html#nvim-features
[Roadmap]: https://neovim.io/roadmap/
[external UIs]: https://github.com/neovim/neovim/wiki/Related-projects#gui-projects
<!-- vim: set tw=80: -->

View File

@@ -1,22 +1,10 @@
version: '{build}'
skip_tags: true
environment:
# The default cpack in the PATH is not CMake
CPACK: C:\Program Files (x86)\CMake\bin\cpack.exe
matrix:
- TARGET: MINGW_64
BUILD_DEPS_SCRIPT: .ci\msys_build_deps.bat
BUILD_SCRIPT: .ci\msys_build.bat
- TARGET: MINGW_32
BUILD_DEPS_SCRIPT: .ci\msys_build_deps.bat
BUILD_SCRIPT: .ci\msys_build.bat
configuration:
- MINGW_64
- MINGW_32
install: []
build_script:
- if defined BUILD_DEPS_SCRIPT call %BUILD_DEPS_SCRIPT%
- call %BUILD_SCRIPT%
# Build artifacts
- cd build
- '"%CPACK%" -G NSIS -C Release'
- '"%CPACK%" -G ZIP -C Release'
- call .ci\build.bat
artifacts:
- path: build/Neovim.zip
- path: build/Neovim.exe

View File

@@ -0,0 +1,23 @@
function(PreventInTreeBuilds)
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
if("${srcdir}" STREQUAL "${bindir}")
message("")
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
message("Neovim doesn't support in-tree builds. It's recommended that you")
message("use a build/ subdirectory:")
message(" mkdir build")
message(" cd build")
message(" cmake <OPTIONS> ..")
message("")
message("Make sure to cleanup some CMake artifacts from this failed build")
message("with:")
message(" rm -rf CMakeFiles CMakeCache.txt")
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
message("")
message(FATAL_ERROR "Stopping build.")
endif()
endfunction()
PreventInTreeBuilds()

View File

@@ -28,6 +28,7 @@ if(DEFINED ENV{TEST_FILTER})
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
endif()
set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
execute_process(
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
--lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua

View File

@@ -142,12 +142,16 @@ configure_file (
find_program(WHOAMI_PROG whoami)
find_program(HOSTNAME_PROG hostname)
if (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PROG})
if (DEFINED ENV{USERNAME})
set(USERNAME $ENV{USERNAME})
elseif (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PROG})
execute_process(COMMAND ${WHOAMI_PROG}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE USERNAME)
endif()
if (EXISTS ${HOSTNAME_PROG})
if (DEFINED ENV{HOSTNAME})
set(HOSTNAME $ENV{HOSTNAME})
elseif (EXISTS ${HOSTNAME_PROG})
execute_process(COMMAND ${HOSTNAME_PROG}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE HOSTNAME)

View File

@@ -7,6 +7,10 @@
#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@"
#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@"
#define NVIM_API_LEVEL @NVIM_API_LEVEL@
#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@
#define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@
#define NVIM_VERSION_CFLAGS "@NVIM_VERSION_CFLAGS@"
#define NVIM_VERSION_BUILD_TYPE "@NVIM_VERSION_BUILD_TYPE@"

View File

@@ -3,6 +3,7 @@ set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime)
set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim)
set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags)
set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt)
set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR})
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax)
@@ -10,13 +11,14 @@ file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax/vim)
add_custom_command(OUTPUT ${GENERATED_SYN_VIM}
COMMAND ${LUA_PRG} ${SYN_VIM_GENERATOR}
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM}
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM} ${FUNCS_DATA}
DEPENDS
${SYN_VIM_GENERATOR}
${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua
${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua
${PROJECT_SOURCE_DIR}/src/nvim/options.lua
${PROJECT_SOURCE_DIR}/src/nvim/eval.c
${FUNCS_DATA}
)
if(POLICY CMP0054)

View File

@@ -9,49 +9,65 @@ function! s:enhance_syntax() abort
highlight link healthInfo ModeMsg
syntax keyword healthSuccess SUCCESS
highlight link healthSuccess Function
highlight link healthSuccess ModeMsg
syntax keyword healthSuggestion SUGGESTION
syntax keyword healthSuggestion SUGGESTIONS
highlight link healthSuggestion String
syntax match healthHelp "|.\{-}|" contains=healthBar
syntax match healthBar "|" contained conceal
highlight link healthHelp Identifier
" We do not care about markdown syntax errors in :CheckHealth output.
highlight! link markdownError Normal
" We don't need code blocks.
silent! syntax clear markdownCodeBlock
endfunction
" Runs the specified healthchecks.
" Runs all discovered healthchecks if a:plugin_names is empty.
function! health#check(plugin_names) abort
let report = ''
let healthchecks = empty(a:plugin_names)
\ ? s:discover_health_checks()
\ : s:to_fn_names(a:plugin_names)
tabnew
setlocal wrap breakindent
setlocal filetype=markdown bufhidden=wipe
setlocal conceallevel=2 concealcursor=nc
setlocal keywordprg=:help
call s:enhance_syntax()
if empty(healthchecks)
let report = "ERROR: No healthchecks found."
call setline(1, 'ERROR: No healthchecks found.')
else
redraw|echo 'Running healthchecks...'
for c in healthchecks
let report .= printf("\n%s\n%s", c, repeat('=',80))
let output = ''
call append('$', split(printf("\n%s\n%s", c, repeat('=',72)), "\n"))
try
let report .= execute('call '.c.'()')
catch /^Vim\%((\a\+)\)\=:E117/
let report .= execute(
\ 'call health#report_error(''No healthcheck found for "'
\ .s:to_plugin_name(c)
\ .'" plugin.'')')
let output = "\n\n".execute('call '.c.'()')
catch
let report .= execute(
\ 'call health#report_error(''Failed to run healthcheck for "'
\ .s:to_plugin_name(c)
\ .'" plugin. Exception:''."\n".v:exception)')
if v:exception =~# '^Vim\%((\a\+)\)\=:E117.*\V'.c
let output = execute(
\ 'call health#report_error(''No healthcheck found for "'
\ .s:to_plugin_name(c)
\ .'" plugin.'')')
else
let output = execute(
\ 'call health#report_error(''Failed to run healthcheck for "'
\ .s:to_plugin_name(c)
\ .'" plugin. Exception:''."\n".v:throwpoint."\n".v:exception)')
endif
endtry
let report .= "\n"
call append('$', split(output, "\n") + [''])
redraw
endfor
endif
tabnew
setlocal bufhidden=wipe
set filetype=markdown
call s:enhance_syntax()
call setline(1, split(report, "\n"))
setlocal nomodified
redraw|echo ''
endfunction
" Starts a new report.
@@ -71,6 +87,11 @@ function! s:indent_after_line1(s, columns) abort
return join(lines, "\n")
endfunction
" Changes ':help clipboard' to '|clipoard|'. Also removes surrounding quotes.
function! s:help_to_link(s) abort
return substitute(a:s, '\v[''"]?:h%[elp] ([^''"]+)[''"]?', '|\1|', 'g')
endfunction
" Format a message for a specific report item
function! s:format_report_message(status, msg, ...) abort " {{{
let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4)
@@ -86,13 +107,13 @@ function! s:format_report_message(status, msg, ...) abort " {{{
" Report each suggestion
if len(suggestions) > 0
let output .= "\n - SUGGESTIONS:"
let output .= "\n - SUGGESTIONS:"
endif
for suggestion in suggestions
let output .= "\n - " . s:indent_after_line1(suggestion, 10)
let output .= "\n - " . s:indent_after_line1(suggestion, 10)
endfor
return output
return s:help_to_link(output)
endfunction " }}}
" Use {msg} to report information in the current section

View File

@@ -1,152 +1,20 @@
let s:bad_responses = [
\ 'unable to parse python response',
\ 'unable to parse',
\ 'unable to get pypi response',
\ 'unable to get neovim executable',
\ 'unable to find neovim version'
\ ]
let s:suggest_faq = 'See https://github.com/neovim/neovim/wiki/FAQ'
function! s:is_bad_response(s) abort
return index(s:bad_responses, a:s) >= 0
endfunction
function! s:trim(s) abort
return substitute(a:s, '^\_s*\|\_s*$', '', 'g')
endfunction
" Simple version comparison.
function! s:version_cmp(a, b) abort
let a = split(a:a, '\.')
let b = split(a:b, '\.')
for i in range(len(a))
if a[i] > b[i]
return 1
elseif a[i] < b[i]
return -1
endif
endfor
return 0
endfunction
" Fetch the contents of a URL.
function! s:download(url) abort
let content = ''
if executable('curl')
let content = system(['curl', '-sL', "'", a:url, "'"])
function! s:check_config() abort
call health#report_start('Configuration')
let sensible_pi = globpath(&runtimepath, '**/sensible.vim', 1, 1)
if empty(sensible_pi)
call health#report_ok('no issues found')
else
call health#report_info("found sensible.vim plugin:\n".join(sensible_pi, "\n"))
call health#report_error("sensible.vim plugin is not needed; Nvim has the same defaults built-in."
\ ." Also, sensible.vim sets 'ttimeoutlen' to a sub-optimal value.",
\ ["Remove sensible.vim plugin, or wrap it in a `if !has('nvim')` check."])
endif
if empty(content) && executable('python')
let script = "
\try:\n
\ from urllib.request import urlopen\n
\except ImportError:\n
\ from urllib2 import urlopen\n
\\n
\try:\n
\ response = urlopen('".a:url."')\n
\ print(response.read().decode('utf8'))\n
\except Exception:\n
\ pass\n
\"
let content = system(['python', '-c', "'", script, "'", '2>/dev/null'])
endif
return content
endfunction
" Get the latest Neovim Python client version from PyPI. Result is cached.
function! s:latest_pypi_version() abort
if exists('s:pypi_version')
return s:pypi_version
endif
let s:pypi_version = 'unable to get pypi response'
let pypi_info = s:download('https://pypi.python.org/pypi/neovim/json')
if !empty(pypi_info)
let pypi_data = json_decode(pypi_info)
let s:pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse')
return s:pypi_version
endif
endfunction
" Get version information using the specified interpreter. The interpreter is
" used directly in case breaking changes were introduced since the last time
" Neovim's Python client was updated.
"
" Returns [
" python executable version,
" current nvim version,
" current pypi nvim status,
" installed version status
" ]
function! s:version_info(python) abort
let pypi_version = s:latest_pypi_version()
let python_version = s:trim(system([
\ a:python,
\ '-c',
\ 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
\ ]))
if empty(python_version)
let python_version = 'unable to parse python response'
endif
let nvim_path = s:trim(system([
\ a:python,
\ '-c',
\ 'import neovim; print(neovim.__file__)',
\ '2>/dev/null']))
let nvim_path = s:trim(system([
\ 'python3',
\ '-c',
\ 'import neovim; print(neovim.__file__)'
\ ]))
" \ '2>/dev/null']))
if empty(nvim_path)
return [python_version, 'unable to find neovim executable', pypi_version, 'unable to get neovim executable']
endif
let nvim_version = 'unable to find neovim version'
let base = fnamemodify(nvim_path, ':h')
for meta in glob(base.'-*/METADATA', 1, 1) + glob(base.'-*/PKG-INFO', 1, 1)
for meta_line in readfile(meta)
if meta_line =~# '^Version:'
let nvim_version = matchstr(meta_line, '^Version: \zs\S\+')
endif
endfor
endfor
let version_status = 'unknown'
if !s:is_bad_response(nvim_version) && !s:is_bad_response(pypi_version)
if s:version_cmp(nvim_version, pypi_version) == -1
let version_status = 'outdated'
else
let version_status = 'up to date'
endif
endif
return [python_version, nvim_version, pypi_version, version_status]
endfunction
" Check the Python interpreter's usability.
function! s:check_bin(bin) abort
if !filereadable(a:bin)
call health#report_error(printf('"%s" was not found.', a:bin))
return 0
elseif executable(a:bin) != 1
call health#report_error(printf('"%s" is not executable.', a:bin))
return 0
endif
return 1
endfunction
" Load the remote plugin manifest file and check for unregistered plugins
function! s:check_manifest() abort
function! s:check_rplugin_manifest() abort
call health#report_start('Remote Plugins')
let existing_rplugins = {}
@@ -204,236 +72,87 @@ function! s:check_manifest() abort
endif
endfunction
function! s:check_performance() abort
call health#report_start('Performance')
function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider')
let python_bin_name = 'python'.(a:version == 2 ? '2' : '3')
let pyenv = resolve(exepath('pyenv'))
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n'
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
let host_prog_var = python_bin_name.'_host_prog'
let host_skip_var = python_bin_name.'_host_skip_check'
let python_bin = ''
let python_multiple = []
if exists('g:'.host_prog_var)
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
endif
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
if empty(python_bin_name)
call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.')
if !empty(pythonx_errs)
call health#report_warn(pythonx_errs)
endif
let old_skip = get(g:, host_skip_var, 0)
let g:[host_skip_var] = 1
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
let g:[host_skip_var] = old_skip
endif
if !empty(python_bin_name)
if exists('g:'.host_prog_var)
let python_bin = exepath(python_bin_name)
endif
let python_bin_name = fnamemodify(python_bin_name, ':t')
endif
if !empty(pythonx_errs)
call health#report_error('Python provider error', pythonx_errs)
endif
if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs)
if !exists('g:'.host_prog_var)
call health#report_info(printf('`g:%s` is not set. Searching for '
\ . '%s in the environment.', host_prog_var, python_bin_name))
endif
if !empty(pyenv)
if empty(pyenv_root)
call health#report_warn(
\ 'pyenv was found, but $PYENV_ROOT is not set.',
\ ['Did you follow the final install instructions?']
\ )
else
call health#report_ok(printf('pyenv found: "%s"', pyenv))
endif
let python_bin = s:trim(system(
\ printf('"%s" which %s 2>/dev/null', pyenv, python_bin_name)))
if empty(python_bin)
call health#report_warn(printf('pyenv couldn''t find %s.', python_bin_name))
endif
endif
if empty(python_bin)
let python_bin = exepath(python_bin_name)
if exists('$PATH')
for path in split($PATH, ':')
let path_bin = path.'/'.python_bin_name
if path_bin != python_bin && index(python_multiple, path_bin) == -1
\ && executable(path_bin)
call add(python_multiple, path_bin)
endif
endfor
if len(python_multiple)
" This is worth noting since the user may install something
" that changes $PATH, like homebrew.
call health#report_info(printf('There are multiple %s executables found. '
\ . 'Set "g:%s" to avoid surprises.', python_bin_name, host_prog_var))
endif
if python_bin =~# '\<shims\>'
call health#report_warn(printf('"%s" appears to be a pyenv shim.', python_bin), [
\ 'The "pyenv" executable is not in $PATH,',
\ 'Your pyenv installation is broken. You should set '
\ . '"g:'.host_prog_var.'" to avoid surprises.',
\ ])
endif
endif
endif
endif
if !empty(python_bin)
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
call health#report_warn('pyenv is not set up optimally.', [
\ printf('Suggestion: Create a virtualenv specifically '
\ . 'for Neovim using pyenv and use "g:%s". This will avoid '
\ . 'the need to install Neovim''s Python client in each '
\ . 'version/virtualenv.', host_prog_var)
\ ])
elseif !empty(venv) && exists('g:'.host_prog_var)
if !empty(pyenv_root)
let venv_root = pyenv_root
else
let venv_root = fnamemodify(venv, ':h')
endif
if resolve(python_bin) !~# '^'.venv_root.'/'
call health#report_warn('Your virtualenv is not set up optimally.', [
\ printf('Suggestion: Create a virtualenv specifically '
\ . 'for Neovim and use "g:%s". This will avoid '
\ . 'the need to install Neovim''s Python client in each '
\ . 'virtualenv.', host_prog_var)
\ ])
endif
endif
endif
if empty(python_bin) && !empty(python_bin_name)
" An error message should have already printed.
call health#report_error(printf('"%s" was not found.', python_bin_name))
elseif !empty(python_bin) && !s:check_bin(python_bin)
let python_bin = ''
endif
" Check if $VIRTUAL_ENV is active
let virtualenv_inactive = 0
if exists('$VIRTUAL_ENV')
if !empty(pyenv)
let pyenv_prefix = resolve(s:trim(system([pyenv, 'prefix'])))
if $VIRTUAL_ENV != pyenv_prefix
let virtualenv_inactive = 1
endif
elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/'
let virtualenv_inactive = 1
endif
endif
if virtualenv_inactive
let suggestions = [
\ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229',
\ ]
" check buildtype
let buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+')
if empty(buildtype)
call health#report_error('failed to get build type from :version')
elseif buildtype =~# '\v(MinSizeRel|Release|RelWithDebInfo)'
call health#report_ok(buildtype)
else
call health#report_info(buildtype)
call health#report_warn(
\ '$VIRTUAL_ENV exists but appears to be inactive. '
\ . 'This could lead to unexpected results.',
\ suggestions)
\ "Non-optimized build-type. Nvim will be slower.",
\ ["Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.",
\ s:suggest_faq])
endif
" Diagnostic output
call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin))
if len(python_multiple)
for path_bin in python_multiple
call health#report_info('Other python executable: ' . path_bin)
endfor
endif
if !empty(python_bin)
let [pyversion, current, latest, status] = s:version_info(python_bin)
if a:version != str2nr(pyversion)
call health#report_warn('Got an unexpected version of Python.' .
\ ' This could lead to confusing error messages.')
endif
if a:version == 3 && str2float(pyversion) < 3.3
call health#report_warn('Python 3.3+ is recommended.')
endif
call health#report_info('Python'.a:version.' version: ' . pyversion)
call health#report_info(printf('%s-neovim Version: %s', python_bin_name, current))
if s:is_bad_response(current)
let suggestions = [
\ 'Error found was: ' . current,
\ 'Use the command `$ pip' . a:version . ' install neovim`',
\ ]
call health#report_error(
\ 'Neovim Python client is not installed.',
\ suggestions)
endif
if s:is_bad_response(latest)
call health#report_warn('Unable to fetch latest Neovim Python client version.')
endif
if s:is_bad_response(status)
call health#report_warn('Latest Neovim Python client versions: ('.latest.')')
else
call health#report_ok('Latest Neovim Python client is installed: ('.status.')')
endif
endif
endfunction
function! s:check_ruby() abort
call health#report_start('Ruby provider')
let min_version = "0.2.4"
let ruby_version = systemlist('ruby -v')[0]
let ruby_prog = provider#ruby#Detect()
let suggestions =
\ ['Install or upgrade the neovim RubyGem using `gem install neovim`.']
function! s:check_tmux() abort
if empty($TMUX) || !executable('tmux')
return
endif
call health#report_start('tmux')
if empty(ruby_prog)
let ruby_prog = 'not found'
let prog_vers = 'not found'
call health#report_error('Missing Neovim RubyGem', suggestions)
" check escape-time
let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
\ s:suggest_faq]
let cmd = 'tmux show-option -qvgs escape-time'
let out = system(cmd)
let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
elseif empty(tmux_esc_time)
call health#report_error('escape-time is not set', suggestions)
elseif tmux_esc_time > 300
call health#report_error(
\ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions)
else
silent let prog_vers = systemlist(ruby_prog . ' --version')[0]
if v:shell_error
let prog_vers = 'outdated'
call health#report_warn('Neovim RubyGem is not up-to-date', suggestions)
elseif s:version_cmp(prog_vers, min_version) == -1
let prog_vers .= ' (outdated)'
call health#report_warn('Neovim RubyGem is not up-to-date', suggestions)
else
call health#report_ok('Found Neovim RubyGem')
endif
call health#report_ok('escape-time: '.tmux_esc_time.'ms')
endif
call health#report_info('Ruby Version: ' . ruby_version)
call health#report_info('Host Executable: ' . ruby_prog)
call health#report_info('Host Version: ' . prog_vers)
" check $TERM
call health#report_info('$TERM: '.$TERM)
if $TERM !~# '\v(tmux-256color|screen-256color)'
call health#report_error(
\ '$TERM should be "screen-256color" or "tmux-256color" when running tmux.',
\ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"",
\ s:suggest_faq])
endif
endfunction
function! s:check_terminfo() abort
if !executable('infocmp')
return
endif
call health#report_start('terminfo')
let suggestions = [
\ "Set key_backspace to \\177 (ASCII BACKSPACE). Run these commands:\n"
\ .'infocmp $TERM | sed ''s/kbs=^[hH]/kbs=\\177/'' > $TERM.ti'
\ ."\n"
\ .'tic $TERM.ti',
\ s:suggest_faq]
let cmd = 'infocmp -L'
let out = system(cmd)
let kbs_entry = matchstr(out, 'key_backspace=\S*')
if v:shell_error
call health#report_error('command failed: '.cmd."\n".out)
elseif !empty(matchstr(out, '\Vkey_backspace=^H'))
call health#report_error('key_backspace (kbs) entry is ^H (ASCII DELETE): '
\ .kbs_entry, suggestions)
else
call health#report_info('key_backspace terminfo entry: '
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
endif
endfunction
function! health#nvim#check() abort
call s:check_manifest()
call s:check_python(2)
call s:check_python(3)
call s:check_ruby()
call s:check_config()
call s:check_performance()
call s:check_rplugin_manifest()
call s:check_terminfo()
call s:check_tmux()
endfunction

View File

@@ -0,0 +1,451 @@
let s:shell_error = 0
function! s:is_bad_response(s) abort
return a:s =~? '\v(^unable)|(^error)|(^outdated)'
endfunction
function! s:trim(s) abort
return substitute(a:s, '^\_s*\|\_s*$', '', 'g')
endfunction
" Simple version comparison.
function! s:version_cmp(a, b) abort
let a = split(a:a, '\.', 0)
let b = split(a:b, '\.', 0)
for i in range(len(a))
if str2nr(a[i]) > str2nr(b[i])
return 1
elseif str2nr(a[i]) < str2nr(b[i])
return -1
endif
endfor
return 0
endfunction
" Handler for s:system() function.
function! s:system_handler(jobid, data, event) abort
if a:event == 'stdout' || a:event == 'stderr'
let self.output .= join(a:data, '')
elseif a:event == 'exit'
let s:shell_error = a:data
endif
endfunction
" Run a system command and timeout after 30 seconds.
function! s:system(cmd, ...) abort
let stdin = a:0 ? a:1 : ''
let opts = {
\ 'output': '',
\ 'on_stdout': function('s:system_handler'),
\ 'on_stderr': function('s:system_handler'),
\ 'on_exit': function('s:system_handler'),
\ }
let jobid = jobstart(a:cmd, opts)
if jobid < 1
call health#report_error(printf('Command error %d: %s', jobid,
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd)))
let s:shell_error = 1
return opts.output
endif
if !empty(stdin)
call jobsend(jobid, stdin)
endif
let res = jobwait([jobid], 30000)
if res[0] == -1
call health#report_error(printf('Command timed out: %s',
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))
call jobstop(jobid)
elseif s:shell_error != 0
call health#report_error(printf("Command error (%d) %s: %s", jobid,
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd,
\ opts.output))
endif
return opts.output
endfunction
function! s:systemlist(cmd, ...) abort
let stdout = split(s:system(a:cmd, a:0 ? a:1 : ''), "\n")
if a:0 > 1 && !empty(a:2)
return filter(stdout, '!empty(v:val)')
endif
return stdout
endfunction
" Fetch the contents of a URL.
function! s:download(url) abort
if executable('curl')
let rv = s:system(['curl', '-sL', a:url])
return s:shell_error ? 'curl error: '.s:shell_error : rv
elseif executable('python')
let script = "
\try:\n
\ from urllib.request import urlopen\n
\except ImportError:\n
\ from urllib2 import urlopen\n
\\n
\response = urlopen('".a:url."')\n
\print(response.read().decode('utf8'))\n
\"
let rv = s:system(['python', '-c', script])
return empty(rv) && s:shell_error
\ ? 'python urllib.request error: '.s:shell_error
\ : rv
endif
return 'missing `curl` and `python`, cannot make pypi request'
endfunction
" Check for clipboard tools.
function! s:check_clipboard() abort
call health#report_start('Clipboard')
let clipboard_tool = provider#clipboard#Executable()
if empty(clipboard_tool)
call health#report_warn(
\ "No clipboard tool found. Using the system clipboard won't work.",
\ ['See |clipboard|.'])
else
call health#report_ok('Clipboard tool found: '. clipboard_tool)
endif
endfunction
" Get the latest Neovim Python client version from PyPI.
function! s:latest_pypi_version() abort
let pypi_version = 'unable to get pypi response'
let pypi_response = s:download('https://pypi.python.org/pypi/neovim/json')
if !empty(pypi_response)
try
let pypi_data = json_decode(pypi_response)
catch /E474/
return 'error: '.pypi_response
endtry
let pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse')
endif
return pypi_version
endfunction
" Get version information using the specified interpreter. The interpreter is
" used directly in case breaking changes were introduced since the last time
" Neovim's Python client was updated.
"
" Returns: [
" {python executable version},
" {current nvim version},
" {current pypi nvim status},
" {installed version status}
" ]
function! s:version_info(python) abort
let pypi_version = s:latest_pypi_version()
let python_version = s:trim(s:system([
\ a:python,
\ '-c',
\ 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
\ ]))
if empty(python_version)
let python_version = 'unable to parse python response'
endif
let nvim_path = s:trim(s:system([
\ a:python,
\ '-c',
\ 'import neovim; print(neovim.__file__)']))
let nvim_path = s:shell_error ? '' : nvim_path
if empty(nvim_path)
return [python_version, 'unable to find nvim executable', pypi_version, 'unable to get nvim executable']
endif
" Assuming that multiple versions of a package are installed, sort them
" numerically in descending order.
function! s:compare(metapath1, metapath2)
let a = matchstr(fnamemodify(a:metapath1, ':p:h:t'), '[0-9.]\+')
let b = matchstr(fnamemodify(a:metapath2, ':p:h:t'), '[0-9.]\+')
return a == b ? 0 : a > b ? 1 : -1
endfunction
let nvim_version = 'unable to find nvim version'
let base = fnamemodify(nvim_path, ':h')
let metas = glob(base.'-*/METADATA', 1, 1) + glob(base.'-*/PKG-INFO', 1, 1)
let metas = sort(metas, 's:compare')
if !empty(metas)
for meta_line in readfile(metas[0])
if meta_line =~# '^Version:'
let nvim_version = matchstr(meta_line, '^Version: \zs\S\+')
break
endif
endfor
endif
let version_status = 'unknown'
if !s:is_bad_response(nvim_version) && !s:is_bad_response(pypi_version)
if s:version_cmp(nvim_version, pypi_version) == -1
let version_status = 'outdated'
else
let version_status = 'up to date'
endif
endif
return [python_version, nvim_version, pypi_version, version_status]
endfunction
" Check the Python interpreter's usability.
function! s:check_bin(bin) abort
if !filereadable(a:bin)
call health#report_error(printf('"%s" was not found.', a:bin))
return 0
elseif executable(a:bin) != 1
call health#report_error(printf('"%s" is not executable.', a:bin))
return 0
endif
return 1
endfunction
function! s:check_python(version) abort
call health#report_start('Python ' . a:version . ' provider')
let python_bin_name = 'python'.(a:version == 2 ? '' : '3')
let pyenv = resolve(exepath('pyenv'))
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n'
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
let host_prog_var = python_bin_name.'_host_prog'
let host_skip_var = python_bin_name.'_host_skip_check'
let python_bin = ''
let python_multiple = []
if exists('g:'.host_prog_var)
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
endif
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
if empty(python_bin_name)
call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.')
if !empty(pythonx_errs)
call health#report_warn(pythonx_errs)
endif
let old_skip = get(g:, host_skip_var, 0)
let g:[host_skip_var] = 1
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
let g:[host_skip_var] = old_skip
endif
if !empty(python_bin_name)
if exists('g:'.host_prog_var)
let python_bin = exepath(python_bin_name)
endif
let python_bin_name = fnamemodify(python_bin_name, ':t')
endif
if !empty(pythonx_errs)
call health#report_error('Python provider error', pythonx_errs)
endif
if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs)
if !exists('g:'.host_prog_var)
call health#report_info(printf('`g:%s` is not set. Searching for '
\ . '%s in the environment.', host_prog_var, python_bin_name))
endif
if !empty(pyenv)
if empty(pyenv_root)
call health#report_warn(
\ 'pyenv was found, but $PYENV_ROOT is not set.',
\ ['Did you follow the final install instructions?']
\ )
else
call health#report_ok(printf('pyenv found: "%s"', pyenv))
endif
let python_bin = s:trim(s:system(
\ printf('"%s" which %s 2>/dev/null', pyenv, python_bin_name)))
if empty(python_bin)
call health#report_warn(printf('pyenv couldn''t find %s.', python_bin_name))
endif
endif
if empty(python_bin)
let python_bin = exepath(python_bin_name)
if exists('$PATH')
for path in split($PATH, ':')
let path_bin = path.'/'.python_bin_name
if path_bin != python_bin && index(python_multiple, path_bin) == -1
\ && executable(path_bin)
call add(python_multiple, path_bin)
endif
endfor
if len(python_multiple)
" This is worth noting since the user may install something
" that changes $PATH, like homebrew.
call health#report_info(printf('There are multiple %s executables found. '
\ . 'Set "g:%s" to avoid surprises.', python_bin_name, host_prog_var))
endif
if python_bin =~# '\<shims\>'
call health#report_warn(printf('"%s" appears to be a pyenv shim.', python_bin), [
\ 'The "pyenv" executable is not in $PATH,',
\ 'Your pyenv installation is broken. You should set '
\ . '"g:'.host_prog_var.'" to avoid surprises.',
\ ])
endif
endif
endif
endif
if !empty(python_bin)
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
call health#report_warn('pyenv is not set up optimally.', [
\ printf('Suggestion: Create a virtualenv specifically '
\ . 'for Neovim using pyenv and use "g:%s". This will avoid '
\ . 'the need to install Neovim''s Python client in each '
\ . 'version/virtualenv.', host_prog_var)
\ ])
elseif !empty(venv) && exists('g:'.host_prog_var)
if !empty(pyenv_root)
let venv_root = pyenv_root
else
let venv_root = fnamemodify(venv, ':h')
endif
if resolve(python_bin) !~# '^'.venv_root.'/'
call health#report_warn('Your virtualenv is not set up optimally.', [
\ printf('Suggestion: Create a virtualenv specifically '
\ . 'for Neovim and use "g:%s". This will avoid '
\ . 'the need to install Neovim''s Python client in each '
\ . 'virtualenv.', host_prog_var)
\ ])
endif
endif
endif
if empty(python_bin) && !empty(python_bin_name)
" An error message should have already printed.
call health#report_error(printf('"%s" was not found.', python_bin_name))
elseif !empty(python_bin) && !s:check_bin(python_bin)
let python_bin = ''
endif
" Check if $VIRTUAL_ENV is active
let virtualenv_inactive = 0
if exists('$VIRTUAL_ENV')
if !empty(pyenv)
let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix'])))
if $VIRTUAL_ENV != pyenv_prefix
let virtualenv_inactive = 1
endif
elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/'
let virtualenv_inactive = 1
endif
endif
if virtualenv_inactive
let suggestions = [
\ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229',
\ ]
call health#report_warn(
\ '$VIRTUAL_ENV exists but appears to be inactive. '
\ . 'This could lead to unexpected results.',
\ suggestions)
endif
" Diagnostic output
call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin))
if len(python_multiple)
for path_bin in python_multiple
call health#report_info('Other python executable: ' . path_bin)
endfor
endif
if !empty(python_bin)
let [pyversion, current, latest, status] = s:version_info(python_bin)
if a:version != str2nr(pyversion)
call health#report_warn('Got an unexpected version of Python.' .
\ ' This could lead to confusing error messages.')
endif
if a:version == 3 && str2float(pyversion) < 3.3
call health#report_warn('Python 3.3+ is recommended.')
endif
call health#report_info('Python'.a:version.' version: ' . pyversion)
call health#report_info(printf('%s-neovim version: %s', python_bin_name, current))
if s:is_bad_response(current)
let suggestions = [
\ 'Error found was: ' . current,
\ 'Use the command `$ pip' . a:version . ' install neovim`',
\ ]
call health#report_error(
\ 'Neovim Python client is not installed.',
\ suggestions)
endif
if s:is_bad_response(latest)
call health#report_warn('Unable to contact PyPI.')
call health#report_error('HTTP request failed: '.latest)
endif
if s:is_bad_response(status)
call health#report_warn(printf('Latest %s-neovim is NOT installed: %s',
\ python_bin_name, latest))
elseif !s:is_bad_response(latest)
call health#report_ok(printf('Latest %s-neovim is installed: %s',
\ python_bin_name, latest))
endif
endif
endfunction
function! s:check_ruby() abort
call health#report_start('Ruby provider')
let ruby_version = 'not found'
if executable('ruby')
let ruby_version = s:systemlist('ruby -v')[0]
endif
let ruby_prog = provider#ruby#Detect()
let suggestions =
\ ['Install or upgrade the neovim RubyGem using `gem install neovim`.']
if empty(ruby_prog)
let ruby_prog = 'not found'
let prog_vers = 'not found'
call health#report_error('Missing Neovim RubyGem', suggestions)
else
silent let latest_gem = get(s:systemlist("gem list -ra '^neovim$' 2>/dev/null | " .
\ "awk -F'[()]' '{print $2}' | " .
\ 'cut -d, -f1'), 0, 'not found')
let latest_desc = ' (latest: ' . latest_gem . ')'
silent let prog_vers = s:systemlist(ruby_prog . ' --version')[0]
if s:shell_error
let prog_vers = 'not found' . latest_desc
call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
elseif s:version_cmp(prog_vers, latest_gem) == -1
let prog_vers .= latest_desc
call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
else
call health#report_ok('Found up-to-date neovim RubyGem')
endif
endif
call health#report_info('Ruby Version: ' . ruby_version)
call health#report_info('Host Executable: ' . ruby_prog)
call health#report_info('Host Version: ' . prog_vers)
endfunction
function! health#provider#check() abort
call s:check_clipboard()
call s:check_python(2)
call s:check_python(3)
call s:check_ruby()
endfunction

View File

@@ -1,19 +1,15 @@
" Maintainer: Anmol Sethi <anmol@aubble.com>
" Ensure Vim is not recursively invoked (man-db does this)
" by forcing man to use cat as the pager.
" More info here http://comments.gmane.org/gmane.editors.vim.devel/29085
if &shell =~# 'fish$'
let s:man_cmd = 'man -P cat ^/dev/null'
let s:man_cmd = 'man ^/dev/null'
else
let s:man_cmd = 'man -P cat 2>/dev/null'
let s:man_cmd = 'man 2>/dev/null'
endif
let s:man_find_arg = "-w"
" TODO(nhooyr) I do not think completion will work on SunOS because I'm not sure if `man -l`
" displays the list of directories that are searched by man for manpages.
" I also do not think Solaris supports the '-P' flag used above and uses only $PAGER.
" TODO(nhooyr) Completion may work on SunOS; I'm not sure if `man -l` displays
" the list of searched directories.
try
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
let s:man_find_arg = '-l'
@@ -22,77 +18,71 @@ catch /E145:/
" Ignore the error in restricted mode
endtry
" We need count and count1 to ensure the section was explicitly set
" by the user. count defaults to 0 which is a valid section and
" count1 defaults to 1 which is also a valid section. Only when they
" are equal was the count explicitly set.
function! man#open_page(count, count1, ...) abort
function! man#open_page(count, count1, mods, ...) abort
if a:0 > 2
call s:error('too many arguments')
return
elseif a:0 ==# 1
if empty(a:1)
elseif a:0 == 0
let ref = &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>')
if empty(ref)
call s:error('no identifier under cursor')
return
endif
elseif a:0 ==# 1
let ref = a:1
else
" We combine the name and sect into a manpage reference so that all
" Combine the name and sect into a manpage reference so that all
" verification/extraction can be kept in a single function.
" If a:2 is a reference as well, that is fine because it is the only
" reference that will match.
let ref = a:2.'('.a:1.')'
endif
try
let [sect, name] = s:extract_sect_and_name_ref(ref)
let [sect, name] = man#extract_sect_and_name_ref(ref)
if a:count ==# a:count1
" user explicitly set a count
" v:count defaults to 0 which is a valid section, and v:count1 defaults to
" 1, also a valid section. If they are equal, count explicitly set.
let sect = string(a:count)
endif
let [sect, name] = s:verify_exists(sect, name)
let [sect, name, path] = s:verify_exists(sect, name)
catch
call s:error(v:exception)
return
endtry
call s:push_tag()
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
let found_man = s:find_man()
if getbufvar(bufname, 'manwidth') ==# s:manwidth()
if found_man
silent execute 'buf' bufnr(bufname)
else
execute 'split' bufname
endif
keepjumps 1
return
endif
if found_man
noautocmd execute 'edit' bufname
if a:mods !~# 'tab' && s:find_man()
noautocmd execute 'silent edit' fnameescape(bufname)
else
noautocmd execute 'split' bufname
noautocmd execute 'silent' a:mods 'split' fnameescape(bufname)
endif
call s:read_page(sect, name)
let b:man_sect = sect
call s:read_page(path)
endfunction
function! man#read_page(ref) abort
try
let [sect, name] = s:extract_sect_and_name_ref(a:ref)
let [sect, name] = s:verify_exists(sect, name)
let [sect, name] = man#extract_sect_and_name_ref(a:ref)
let [b:man_sect, name, path] = s:verify_exists(sect, name)
catch
call s:error(v:exception)
" call to s:error() is unnecessary
return
endtry
call s:read_page(sect, name)
call s:read_page(path)
endfunction
function! s:read_page(sect, name) abort
function! s:read_page(path) abort
setlocal modifiable
setlocal noreadonly
keepjumps %delete _
let b:manwidth = s:manwidth()
silent execute 'read!env MANWIDTH='.b:manwidth s:man_cmd s:man_args(a:sect, a:name)
" remove all the backspaced text
silent execute 'keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
silent keepjumps %delete _
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
" http://comments.gmane.org/gmane.editors.vim.devel/29085
" Respect $MANWIDTH, or default to window width.
let cmd = 'env MANPAGER=cat'.(empty($MANWIDTH) ? ' MANWIDTH='.winwidth(0) : '')
let cmd .= ' '.s:man_cmd.' '.shellescape(a:path)
silent put =system(cmd)
" Remove all backspaced characters.
execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
while getline(1) =~# '^\s*$'
silent keepjumps 1delete _
endwhile
@@ -101,17 +91,17 @@ endfunction
" attempt to extract the name and sect out of 'name(sect)'
" otherwise just return the largest string of valid characters in ref
function! s:extract_sect_and_name_ref(ref) abort
function! man#extract_sect_and_name_ref(ref) abort
if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled.
throw 'manpage name starts with ''-'''
throw 'manpage name cannot start with ''-'''
endif
let ref = matchstr(a:ref, '[^()]\+([^()]\+)')
if empty(ref)
let name = matchstr(a:ref, '[^()]\+')
if empty(name)
throw 'manpage reference contains only parantheses'
throw 'manpage reference cannot contain only parentheses'
endif
return ['', name]
return [get(b:, 'man_default_sects', ''), name]
endif
let left = split(ref, '(')
" see ':Man 3X curses' on why tolower.
@@ -120,21 +110,29 @@ function! s:extract_sect_and_name_ref(ref) abort
return [tolower(split(left[1], ')')[0]), left[0]]
endfunction
function! s:verify_exists(sect, name) abort
let path = system(s:man_cmd.' '.s:man_find_arg.' '.s:man_args(a:sect, a:name))
if path !~# '^\/'
if empty(a:sect)
throw 'no manual entry for '.a:name
endif
function! s:get_path(sect, name) abort
if empty(a:sect)
let path = system(s:man_cmd.' '.s:man_find_arg.' '.shellescape(a:name))
if path !~# '^\/'
throw 'no manual entry for '.a:name.'('.a:sect.') or '.a:name
throw 'no manual entry for '.a:name
endif
return path
endif
if a:name =~# '\/'
" We do not need to extract the section/name from the path if the name is
" just a path.
return ['', a:name]
" '-s' flag handles:
" - tokens like 'printf(echo)'
" - sections starting with '-'
" - 3pcap section (found on macOS)
" - commas between sections (for section priority)
return system(s:man_cmd.' '.s:man_find_arg.' -s '.shellescape(a:sect).' '.shellescape(a:name))
endfunction
function! s:verify_exists(sect, name) abort
let path = s:get_path(a:sect, a:name)
if path !~# '^\/'
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
if path !~# '^\/'
let path = s:get_path('', a:name)
endif
endif
" We need to extract the section from the path because sometimes
" the actual section of the manpage is more specific than the section
@@ -142,7 +140,8 @@ function! s:verify_exists(sect, name) abort
" Also on linux, it seems that the name is case insensitive. So if one does
" ':Man PRIntf', we still want the name of the buffer to be 'printf' or
" whatever the correct capitilization is.
return s:extract_sect_and_name_path(path[:len(path)-2])
let path = path[:len(path)-2]
return s:extract_sect_and_name_path(path) + [path]
endfunction
let s:tag_stack = []
@@ -158,7 +157,7 @@ endfunction
function! man#pop_tag() abort
if !empty(s:tag_stack)
let tag = remove(s:tag_stack, -1)
execute tag['buf'].'b'
execute 'silent' tag['buf'].'buffer'
call cursor(tag['lnum'], tag['col'])
endif
endfunction
@@ -170,13 +169,15 @@ function! s:extract_sect_and_name_path(path) abort
let tail = fnamemodify(tail, ':r')
endif
let sect = matchstr(tail, '\.\zs[^.]\+$')
let name = matchstr(tail, '^.\+\ze\.[^.]\+$')
let name = matchstr(tail, '^.\+\ze\.')
return [sect, name]
endfunction
function! s:find_man() abort
if &filetype ==# 'man'
return 1
elseif winnr('$') ==# 1
return 0
endif
let thiswin = winnr()
while 1
@@ -189,32 +190,6 @@ function! s:find_man() abort
endwhile
endfunction
function! s:manwidth() abort
" The reason for respecting $MANWIDTH even if it is wider/smaller than the
" current window is that the current window might only be temporarily
" narrow/wide. Since we don't reflow, we should just assume the
" user knows what they're doing and respect $MANWIDTH.
if empty($MANWIDTH)
" If $MANWIDTH is not set, we do not assign directly to $MANWIDTH because
" then $MANWIDTH will always stay the same value as we only use
" winwidth(0) when $MANWIDTH is empty. Instead we set it locally for the command.
return winwidth(0)
endif
return $MANWIDTH
endfunction
function! s:man_args(sect, name) abort
if empty(a:sect)
return shellescape(a:name)
endif
" The '-s' flag is very useful.
" We do not need to worry about stuff like 'printf(echo)'
" (two manpages would be interpreted by man without -s)
" We do not need to check if the sect starts with '-'
" Lastly, the 3pcap section on macOS doesn't work without -s
return '-s '.shellescape(a:sect).' '.shellescape(a:name)
endfunction
function! s:error(msg) abort
redraw
echohl ErrorMsg
@@ -224,7 +199,7 @@ endfunction
let s:mandirs = join(split(system(s:man_cmd.' '.s:man_find_arg), ':\|\n'), ',')
" see s:extract_sect_and_name_ref on why tolower(sect)
" see man#extract_sect_and_name_ref on why tolower(sect)
function! man#complete(arg_lead, cmd_line, cursor_pos) abort
let args = split(a:cmd_line)
let l = len(args)
@@ -271,16 +246,35 @@ function! man#complete(arg_lead, cmd_line, cursor_pos) abort
return uniq(sort(map(globpath(s:mandirs,'man?/'.name.'*.'.sect.'*', 0, 1), 's:format_candidate(v:val, sect)'), 'i'))
endfunction
function! s:format_candidate(c, sect) abort
if a:c =~# '\.\%(pdf\|in\)$' " invalid extensions
function! s:format_candidate(path, sect) abort
if a:path =~# '\.\%(pdf\|in\)$' " invalid extensions
return
endif
let [sect, name] = s:extract_sect_and_name_path(a:c)
let [sect, name] = s:extract_sect_and_name_path(a:path)
if sect ==# a:sect
return name
elseif sect =~# a:sect.'[^.]\+$'
elseif sect =~# a:sect.'.\+$'
" We include the section if the user provided section is a prefix
" of the actual section.
return name.'('.sect.')'
endif
endfunction
function! man#init_pager() abort
" Remove all backspaced characters.
execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
if getline(1) =~# '^\s*$'
silent keepjumps 1delete _
else
keepjumps 1
endif
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
" all caps it is impossible to tell what the original capitilization was.
let ref = tolower(matchstr(getline(1), '^\S\+'))
try
let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
catch
let b:man_sect = ''
endtry
execute 'silent file man://'.fnameescape(ref)
endfunction

View File

@@ -31,34 +31,51 @@ function! s:try_cmd(cmd, ...)
endfunction
let s:cache_enabled = 1
if executable('pbcopy')
let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0
elseif exists('$DISPLAY') && executable('xsel')
let s:copy['+'] = 'xsel --nodetach -i -b'
let s:paste['+'] = 'xsel -o -b'
let s:copy['*'] = 'xsel --nodetach -i -p'
let s:paste['*'] = 'xsel -o -p'
elseif exists('$DISPLAY') && executable('xclip')
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
let s:paste['+'] = 'xclip -o -selection clipboard'
let s:copy['*'] = 'xclip -quiet -i -selection primary'
let s:paste['*'] = 'xclip -o -selection primary'
elseif executable('lemonade')
let s:copy['+'] = 'lemonade copy'
let s:paste['+'] = 'lemonade paste'
let s:copy['*'] = 'lemonade copy'
let s:paste['*'] = 'lemonade paste'
elseif executable('doitclient')
let s:copy['+'] = 'doitclient wclip'
let s:paste['+'] = 'doitclient wclip -r'
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
else
echom 'clipboard: No clipboard tool available. See :help clipboard'
let s:err = ''
function! provider#clipboard#Error() abort
return s:err
endfunction
function! provider#clipboard#Executable() abort
if executable('pbcopy')
let s:copy['+'] = 'pbcopy'
let s:paste['+'] = 'pbpaste'
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
let s:cache_enabled = 0
return 'pbcopy'
elseif exists('$DISPLAY') && executable('xsel')
let s:copy['+'] = 'xsel --nodetach -i -b'
let s:paste['+'] = 'xsel -o -b'
let s:copy['*'] = 'xsel --nodetach -i -p'
let s:paste['*'] = 'xsel -o -p'
return 'xsel'
elseif exists('$DISPLAY') && executable('xclip')
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
let s:paste['+'] = 'xclip -o -selection clipboard'
let s:copy['*'] = 'xclip -quiet -i -selection primary'
let s:paste['*'] = 'xclip -o -selection primary'
return 'xclip'
elseif executable('lemonade')
let s:copy['+'] = 'lemonade copy'
let s:paste['+'] = 'lemonade paste'
let s:copy['*'] = 'lemonade copy'
let s:paste['*'] = 'lemonade paste'
return 'lemonade'
elseif executable('doitclient')
let s:copy['+'] = 'doitclient wclip'
let s:paste['+'] = 'doitclient wclip -r'
let s:copy['*'] = s:copy['+']
let s:paste['*'] = s:paste['+']
return 'doitclient'
endif
let s:err = 'clipboard: No clipboard tool available. See :help clipboard'
return ''
endfunction
if empty(provider#clipboard#Executable())
finish
endif

View File

@@ -190,7 +190,8 @@ function! s:RegistrationCommands(host) abort
call remote#host#RegisterClone(host_id, a:host)
let pattern = s:plugin_patterns[a:host]
let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 0, 1)
let paths = map(paths, 'tr(v:val,"\\","/")') " Normalize slashes #4795
let paths = map(paths, 'tr(resolve(v:val),"\\","/")') " Normalize slashes #4795
let paths = uniq(sort(paths))
if empty(paths)
return []
endif
@@ -260,11 +261,9 @@ endfunction
function! remote#host#LoadErrorForHost(host, log) abort
return 'Failed to load '. a:host . ' host. '.
\ 'You can try to see what happened '.
\ 'by starting Neovim with the environment variable '.
\ a:log . ' set to a file and opening the generated '.
\ 'log file. Also, the host stderr is available '.
\ 'in messages.'
\ 'You can try to see what happened by starting nvim with '.
\ a:log . ' set and opening the generated log file.'.
\ ' Also, the host stderr is available in messages.'
endfunction

View File

@@ -2,6 +2,7 @@
" Compiler: GNU C Compiler
" Maintainer: Nikolai Weibull <now@bitwi.se>
" Latest Revision: 2010-10-14
" added line suggested by Anton Lindqvist 2016 Mar 31
if exists("current_compiler")
finish
@@ -24,6 +25,7 @@ CompilerSet errorformat=
\%f:%l:\ %trror:\ %m,
\%f:%l:\ %tarning:\ %m,
\%f:%l:\ %m,
\%f:\\(%*[^\\)]\\):\ %m,
\\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
\%D%*\\a[%*\\d]:\ Entering\ directory\ [`']%f',
\%X%*\\a[%*\\d]:\ Leaving\ directory\ [`']%f',

View File

@@ -1,7 +1,7 @@
" Vim compiler file
" Compiler: HTML Tidy
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2013 Jul 7
" Last Change: 2016 Apr 21
if exists("current_compiler")
finish
@@ -12,8 +12,8 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal
command -nargs=* CompilerSet setlocal <args>
endif
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %:S
" sample warning: foo.html:8:1: Warning: inserting missing 'foobar' element
" sample error: foo.html:9:2: Error: <foobar> is not recognized!
CompilerSet errorformat=%f:%l:%c:\ Error:%m,%f:%l:%c:\ Warning:%m,%-G%.%#
" foo.html:8:1: Warning: inserting missing 'foobar' element
" foo.html:9:2: Error: <foobar> is not recognized!
CompilerSet errorformat=%f:%l:%c:\ %trror:%m,%f:%l:%c:\ %tarning:%m,%-G%.%#

View File

@@ -14,13 +14,13 @@ C API for Nvim *API* *api*
==============================================================================
1. Introduction *api-intro*
Nvim exposes a public API for external code to interact with the Nvim core. In
the present version of Nvim the API is primarily used by external processes to
interact with Nvim using the msgpack-rpc protocol, see |msgpack-rpc|. The API
will also be used from vimscript to access new Nvim core features, but this is
not implemented yet. Later on, Nvim might be embeddable in C applications as
libnvim, and the application will then control the embedded instance by
calling the C API directly.
Nvim exposes a public API for external code to interact with the Nvim core.
The API is used by external processes to interact with Nvim using the
msgpack-rpc protocol, see |msgpack-rpc|. The API is used from vimscript to
access some new Nvim core features. See |eval-api| for how api functions are
called from vimscript. Later on, Nvim might be embeddable in C applications as
libnvim, and the application will then control the embedded instance by calling
the C API directly.
==============================================================================
2. API Types *api-types*
@@ -51,9 +51,10 @@ Tabpage -> enum value kObjectTypeTabpage
Nvim exposes metadata about the API as a Dictionary with the following keys:
functions calling signature of the API functions
types The custom handle types defined by Nvim
error_types The possible kinds of errors an API function can exit with.
version Nvim version, API level/compatibility
functions API function signatures
types Custom handle types defined by Nvim
error_types Possible error types returned by API functions
This metadata is mostly useful for external programs accessing the API via
RPC, see |rpc-api|.
@@ -73,10 +74,10 @@ Another use case are plugins that show output in an append-only buffer, and
want to add highlights to the outputs. Highlight data cannot be preserved
on writing and loading a buffer to file, nor in undo/redo cycles.
Highlights are registered using the |buffer_add_highlight| function, see the
Highlights are registered using the |nvim_buf_add_highlight| function, see the
generated API documentation for details. If an external highlighter plugin is
adding a large number of highlights in a batch, performance can be improved by
calling |buffer_add_highlight| as an asynchronous notification, after first
calling |nvim_buf_add_highlight| as an asynchronous notification, after first
(synchronously) reqesting a source id. Here is an example using wrapper
functions in the python client:
>
@@ -91,10 +92,19 @@ functions in the python client:
buf.clear_highlight(src)
<
If the highlights don't need to be deleted or updated, just pass -1 as
src_id (this is the default in python). |buffer_clear_highlight| can be used
to clear highligts from a specific source, in a specific line range or the
entire buffer by passing in the line range 0, -1 (the later is the default
src_id (this is the default in python). |nvim_buf_clear_highlight| can be used
to clear highlights from a specific source, in a specific line range or the
entire buffer by passing in the line range 0, -1 (the latter is the default
in python as used above).
An example of calling the api from vimscript: >
call nvim_buf_set_lines(0, 0, 0, v:true, ["test text"])
let src = nvim_buf_add_highlight(0, 0, "String", 1, 0, 4)
call nvim_buf_add_highlight(0, src, "Identifier", 0, 5, -1)
" later
call nvim_buf_clear_highlight(0, src, 0, -1)
>
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -256,7 +256,6 @@ Name triggered by ~
Options
|FileType| when the 'filetype' option has been set
|Syntax| when the 'syntax' option has been set
|EncodingChanged| after the 'encoding' option has been changed
|TermChanged| after the value of 'term' has changed
|OptionSet| after setting any option
@@ -557,9 +556,6 @@ CursorMoved After the cursor was moved in Normal or Visual
CursorMovedI After the cursor was moved in Insert mode.
Not triggered when the popup menu is visible.
Otherwise the same as CursorMoved.
*EncodingChanged*
EncodingChanged Fires off after the 'encoding' option has been
changed. Useful to set up fonts, for example.
*FileAppendCmd*
FileAppendCmd Before appending to a file. Should do the
appending to the file. Use the '[ and ']
@@ -618,9 +614,6 @@ FileChangedShell When Vim notices that the modification time of
*FileChangedShellPost*
FileChangedShellPost After handling a file that was changed outside
of Vim. Can be used to update the statusline.
*FileEncoding*
FileEncoding Obsolete. It still works and is equivalent
to |EncodingChanged|.
*FileReadCmd*
FileReadCmd Before reading a file with a ":read" command.
Should do the reading of the file. |Cmd-event|
@@ -947,7 +940,15 @@ VimEnter After doing all the startup stuff, including
loading vimrc files, executing the "-c cmd"
arguments, creating all windows and loading
the buffers in them.
*VimLeave*
Just before this event is triggered the
|v:vim_did_enter| variable is set, so that you
can do: >
if v:vim_did_enter
call s:init()
else
au VimEnter * call s:init()
endif
< *VimLeave*
VimLeave Before exiting Vim, just after writing the
.shada file. Executed only once, like
VimLeavePre.

View File

@@ -0,0 +1,48 @@
*deprecated.txt* {Nvim}
NVIM REFERENCE MANUAL
Nvim *deprecated*
The items listed below are "deprecated". This means they will be removed in
the future. They should not be used in new scripts, and old scripts should be
updated.
==============================================================================
Normal commands ~
*]f*
*[f* Same as "gf".
Commands ~
*:rv*
*:rviminfo* Deprecated alias to |:rshada| command.
*:wv*
*:wviminfo* Deprecated alias to |:wshada| command.
Events ~
*EncodingChanged* Never fired; 'encoding' is always "utf-8".
*FileEncoding* Never fired; equivalent to |EncodingChanged|.
Highlight groups ~
*hl-VisualNOS* Obsolete. |vim-differences| {Nvim}
Functions ~
*buffer_exists()* Obsolete name for |bufexists()|.
*buffer_name()* Obsolete name for |bufname()|.
*buffer_number()* Obsolete name for |bufnr()|.
*file_readable()* Obsolete name for |filereadable()|.
*highlight_exists()* Obsolete name for |hlexists()|.
*highlightID()* Obsolete name for |hlID()|.
*last_buffer_nr()* Obsolete name for bufnr("$").
Options ~
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
*'vi'*
*'viminfo'* Deprecated alias to 'shada' option.
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -124,13 +124,26 @@ include the kitchen sink... but you can use it for plumbing."
==============================================================================
2. Design decisions *design-decisions*
Jargon *dev-jargon*
JARGON *dev-jargon*
API client ~
All external UIs and remote plugins (as opposed to regular Vim plugins) are
"clients" in general; but we call something an "API client" if its purpose is
to abstract or wrap the RPC API for the convenience of other applications
(just like a REST client or SDK such as boto3 for AWS: you can speak AWS REST
using an HTTP client like curl, but boto3 wraps that in a convenient python
interface). For example, the Nvim lua-client is an API client:
https://github.com/neovim/lua-client
Host ~
A plugin "host" is both a client (of the Nvim API) and a server (of an
external platform, e.g. python). It is a remote plugin that hosts other
plugins.
Remote plugin ~
Arbitrary code registered via |:UpdateRemotePlugins|, that runs in a separate
process and communicates with Nvim via the |api|.
Window ~
The word "window" is commonly used for several things: A window on the screen,
the xterm window, a window inside Vim to view a buffer.
@@ -145,7 +158,7 @@ window View on a buffer. There can be several windows in Vim,
together with the command line, menubar, toolbar, etc. they
fit in the shell.
Providers *dev-provider*
PROVIDERS *dev-provider*
A goal of Nvim is to allow extension of the editor without special knowledge
in the core. But some Vim components are too tightly coupled; in those cases
@@ -189,8 +202,35 @@ Python host isn't installed then the plugin will "think" it is running in
a Vim compiled without the |+python| feature.
RPC API
API client
remote plugin
API *dev-api*
Use this pattern to name new API functions:
nvim_{thing}_{action}_{arbitrary-qualifiers}
If the function acts on an object then {thing} is the name of that object
(e.g. "buf" or "win"). If the function operates in a "global" context then
{thing} is usually omitted (but consider "namespacing" your global operations
with a {thing} that groups functions under a common concept).
Use existing common {action} names if possible:
add Append to, or insert into, a collection
get Get a thing (or subset of things by some query)
set Set a thing
del Delete a thing (or group of things)
list Get all things
Use consistent names for {thing} in all API functions. E.g. a buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others.
Example: `nvim_get_current_line` acts on the global editor state; the common
{action} "get" is used but {thing} is omitted.
Example: `nvim_buf_add_highlight` acts on a `Buffer` object (the first
parameter) and uses the common {action} "add".
Example: `nvim_list_bufs` operates in a global context (first parameter is
_not_ a Buffer). The common {action} "list" indicates that it lists all
bufs (plural) in the global context.
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -1,12 +1,12 @@
*diff.txt* For Vim version 7.4. Last change: 2015 Nov 01
*diff.txt* For Vim version 7.4. Last change: 2016 Aug 24
VIM REFERENCE MANUAL by Bram Moolenaar
*diff* *diff-mode*
This file describes |diff-mode|, which shows the differences between two,
three, or four versions of the same file.
This file describes the |+diff| feature: Showing differences between two to
eight versions of the same file.
The basics are explained in section |08.7| of the user manual.
@@ -109,7 +109,7 @@ To make these commands use a vertical split, prepend |:vertical|. Examples: >
If you always prefer a vertical split include "vertical" in 'diffopt'.
*E96*
There can be up to four buffers with 'diff' set.
There can be up to eight buffers with 'diff' set.
Since the option values are remembered with the buffer, you can edit another
file for a moment and come back to the same file and be in diff mode again.

View File

@@ -267,9 +267,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is
files.
See |CTRL-^| above for further details.
[count]]f *]f* *[f*
[count][f Same as "gf". Deprecated.
*gf* *E446* *E447*
[count]gf Edit the file whose name is under or after the cursor.
Mnemonic: "goto file".

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
*eval.txt* For Vim version 7.4. Last change: 2016 Jun 04
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -43,6 +43,7 @@ Number A 32 or 64 bit signed number. |expr-number| *Number*
Float A floating point number. |floating-point-format| *Float*
Examples: 123.456 1.15e-6 -1.1e3
*E928*
String A NUL terminated string of 8-bit unsigned characters (bytes).
|expr-string| Examples: "ab\txx\"--" 'x-z''a,c'
@@ -1028,8 +1029,8 @@ A string constant accepts these special characters:
\x. byte specified with one hex number (must be followed by non-hex char)
\X.. same as \x..
\X. same as \x.
\u.... character specified with up to 4 hex numbers, stored according to the
current value of 'encoding' (e.g., "\u02a4")
\u.... character specified with up to 4 hex numbers, stored as UTF-8
(e.g., "\u02a4")
\U.... same as \u but allows up to 8 hex numbers.
\b backspace <BS>
\e escape <Esc>
@@ -1044,8 +1045,7 @@ A string constant accepts these special characters:
utf-8 character, use \uxxxx as mentioned above.
Note that "\xff" is stored as the byte 255, which may be invalid in some
encodings. Use "\u00ff" to store character 255 according to the current value
of 'encoding'.
encodings. Use "\u00ff" to store character 255 correctly as UTF-8.
Note that "\000" and "\x00" force the end of the string.
@@ -1305,6 +1305,10 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only
window has number zero (unlike most other places where a
window gets a number).
*v:beval_winid* *beval_winid-variable*
v:beval_winid The window ID of the window, over which the mouse pointer is.
Otherwise like v:beval_winnr.
*v:char* *char-variable*
v:char Argument for evaluating 'formatexpr' and used for the typed
character when using <expr> in an abbreviation |:map-<expr>|.
@@ -1554,6 +1558,10 @@ v:mouse_win Window number for a mouse click obtained with |getchar()|.
First window has number 1, like with |winnr()|. The value is
zero when there was no mouse button click.
*v:mouse_winid* *mouse_winid-variable*
v:mouse_winid Window ID for a mouse click obtained with |getchar()|.
The value is zero when there was no mouse button click.
*v:mouse_lnum* *mouse_lnum-variable*
v:mouse_lnum Line number for a mouse click obtained with |getchar()|.
This is the text line number, not the screen line number. The
@@ -1765,13 +1773,17 @@ v:version Version number of Vim: Major version number times 100 plus
version 5.0 and 5.1 may have a patch 123, but these are
completely different.
*v:vim_did_enter* *vim_did_enter-variable*
v:vim_did_enter Zero until most of startup is done. It is set to one just
before |VimEnter| autocommands are triggered.
*v:warningmsg* *warningmsg-variable*
v:warningmsg Last given warning message. It's allowed to set this variable.
*v:windowid* *windowid-variable* {Nvim}
v:windowid Application-specific window ID ("window handle" in MS-Windows)
which may be set by any attached UI. Defaults to zero.
Note: for windows inside Vim use |winnr()|.
Note: for windows inside Vim use |winnr()| or |win_getid()|.
==============================================================================
4. Builtin Functions *functions*
@@ -1813,6 +1825,7 @@ buflisted({expr}) Number TRUE if buffer {expr} is listed
bufloaded({expr}) Number TRUE if buffer {expr} is loaded
bufname({expr}) String Name of the buffer {expr}
bufnr({expr} [, {create}]) Number Number of the buffer {expr}
bufwinid({expr}) Number window ID of buffer {expr}
bufwinnr({expr}) Number window number of buffer {expr}
byte2line({byte}) Number line number at byte count {byte}
byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr}
@@ -1897,7 +1910,8 @@ getcmdline() String return the current command-line
getcmdpos() Number return cursor position in command-line
getcmdtype() String return current command-line type
getcmdwintype() String return current command-line window type
getcompletion({pat}, {type}) List list of cmdline completion matches
getcompletion({pat}, {type} [, {filtered}])
List list of cmdline completion matches
getcurpos() List position of the cursor
getcwd([{winnr} [, {tabnr}]]) String the current working directory
getfontname([{name}]) String name of font being used
@@ -2009,6 +2023,7 @@ msgpackdump({list}) List dump a list of objects to msgpack
msgpackparse({list}) List parse msgpack to a list of objects
nextnonblank({lnum}) Number line nr of non-blank line >= {lnum}
nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr}
nvim_...({args}...) any call nvim |api| functions
or({expr}, {expr}) Number bitwise OR
pathshorten({expr}) String shorten directory names in a path
pow({x}, {y}) Float {x} to the power of {y}
@@ -2147,6 +2162,7 @@ values({dict}) List values in {dict}
virtcol({expr}) Number screen column of cursor or mark
visualmode([expr]) String last visual mode used
wildmenumode() Number whether 'wildmenu' mode is active
win_findbuf( {bufnr}) List find windows containing {bufnr}
win_getid( [{win} [, {tab}]]) Number get window ID for {win} in {tab}
win_gotoid( {expr}) Number go to window with ID {expr}
win_id2tabwin( {expr}) List get tab window nr from window ID
@@ -2208,11 +2224,9 @@ and({expr}, {expr}) *and()*
Example: >
:let flag = and(bits, 0x80)
api_info() *api_info()*
Returns Dictionary of |api-metadata|.
append({lnum}, {expr}) *append()*
When {expr} is a |List|: Append each item of the |List| as a
text line below line {lnum} in the current buffer.
@@ -2243,6 +2257,7 @@ arglistid([{winnr} [, {tabnr}]])
With {winnr} only use this window in the current tab page.
With {winnr} and {tabnr} use the window in the specified tab
page.
{winnr} can be the window number or the window ID.
*argv()*
argv([{nr}]) The result is the {nr}th file in the argument list of the
@@ -2414,8 +2429,6 @@ bufexists({expr}) *bufexists()*
for MS-Windows 8.3 names in the form "c:\DOCUME~1"
Use "bufexists(0)" to test for the existence of an alternate
file name.
*buffer_exists()*
Obsolete name: buffer_exists().
buflisted({expr}) *buflisted()*
The result is a Number, which is non-zero if a buffer called
@@ -2454,8 +2467,6 @@ bufname({expr}) *bufname()*
bufname(3) name of buffer 3
bufname("%") name of current buffer
bufname("file2") name of buffer where "file2" matches.
< *buffer_name()*
Obsolete name: buffer_name().
*bufnr()*
bufnr({expr} [, {create}])
@@ -2471,10 +2482,16 @@ bufnr({expr} [, {create}])
of existing buffers. Note that not all buffers with a smaller
number necessarily exist, because ":bwipeout" may have removed
them. Use bufexists() to test for the existence of a buffer.
*buffer_number()*
Obsolete name: buffer_number().
*last_buffer_nr()*
Obsolete name for bufnr("$"): last_buffer_nr().
bufwinid({expr}) *bufwinid()*
The result is a Number, which is the window ID of the first
window associated with buffer {expr}. For the use of {expr},
see |bufname()| above. If buffer {expr} doesn't exist or
there is no such window, -1 is returned. Example: >
echo "A window containing buffer 1 is " . (bufwinid(1))
<
Only deals with the current tab page.
bufwinnr({expr}) *bufwinnr()*
The result is a Number, which is the number of the first
@@ -2526,8 +2543,6 @@ byteidxcomp({expr}, {nr}) *byteidxcomp()*
< The first and third echo result in 3 ('e' plus composing
character is 3 bytes), the second echo results in 1 ('e' is
one byte).
Only works different from byteidx() when 'encoding' is set to
a Unicode encoding.
call({func}, {arglist} [, {dict}]) *call()* *E699*
Call function {func} with the items in |List| {arglist} as
@@ -2562,11 +2577,11 @@ char2nr({expr}[, {utf8}]) *char2nr()*
Return number value of the first char in {expr}. Examples: >
char2nr(" ") returns 32
char2nr("ABC") returns 65
< When {utf8} is omitted or zero, the current 'encoding' is used.
Example for "utf-8": >
char2nr("á") returns 225
char2nr("á"[0]) returns 195
< With {utf8} set to 1, always treat as utf-8 characters.
< Non-ASCII characters are always treated as UTF-8 characters.
{utf8} has no effect, and exists only for
backwards-compatibility.
A combining character is a separate character.
|nr2char()| does the opposite.
@@ -3262,8 +3277,6 @@ filereadable({file}) *filereadable()*
expression, which is used as a String.
If you don't care about the file being readable you can use
|glob()|.
*file_readable()*
Obsolete name: file_readable().
filewritable({file}) *filewritable()*
@@ -3549,8 +3562,8 @@ getchar([expr]) *getchar()*
When the user clicks a mouse button, the mouse event will be
returned. The position can then be found in |v:mouse_col|,
|v:mouse_lnum| and |v:mouse_win|. This example positions the
mouse as it would normally happen: >
|v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. This
example positions the mouse as it would normally happen: >
let c = getchar()
if c == "\<LeftMouse>" && v:mouse_win > 0
exe v:mouse_win . "wincmd w"
@@ -3661,7 +3674,7 @@ getcmdwintype() *getcmdwintype()*
values are the same as |getcmdtype()|. Returns an empty string
when not in the command-line window.
getcompletion({pat}, {type}) *getcompletion()*
getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
Return a list of command-line completion matches. {type}
specifies what for. The following completion types are
supported:
@@ -3701,6 +3714,10 @@ getcompletion({pat}, {type}) *getcompletion()*
Otherwise only items matching {pat} are returned. See
|wildcards| for the use of special characters in {pat}.
If the optional {filtered} flag is set to 1, then 'wildignore'
is applied to filter the results. Otherwise all the matches
are returned. The 'wildignorecase' option always applies.
If there are no matches, an empty list is returned. An
invalid value for {type} produces an error.
@@ -3726,6 +3743,7 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()*
getcwd(0)
getcwd(0, 0)
< If {winnr} is -1 it is ignored, only the tab is resolved.
{winnr} can be the window number or the window ID.
getfsize({fname}) *getfsize()*
@@ -3820,7 +3838,9 @@ getline({lnum} [, {end}])
getloclist({nr}) *getloclist()*
Returns a list with all the entries in the location list for
window {nr}. When {nr} is zero the current window is used.
window {nr}. {nr} can be the window number or the window ID.
When {nr} is zero the current window is used.
For a location list window, the displayed location list is
returned. For an invalid window number {nr}, an empty list is
returned. Otherwise, same as |getqflist()|.
@@ -3948,6 +3968,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
Note that {varname} must be the name without "w:".
Tabs are numbered starting with one. For the current tabpage
use |getwinvar()|.
{winnr} can be the window number or the window ID.
When {winnr} is zero the current window is used.
This also works for a global option, buffer-local option and
window-local option, but it doesn't work for a global variable
@@ -4075,7 +4096,8 @@ haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()*
haslocaldir()
haslocaldir(0)
haslocaldir(0, 0)
< If {winnr} is -1 it is ignored, only the tab is resolved.
< {winnr} can be the window number or the window ID.
If {winnr} is -1 it is ignored, only the tab is resolved.
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is 1 if there is a mapping that
@@ -4186,8 +4208,6 @@ hlexists({name}) *hlexists()*
defined in some way. Not necessarily when highlighting has
been defined for it, it may also have been used for a syntax
item.
*highlight_exists()*
Obsolete name: highlight_exists().
*hlID()*
hlID({name}) The result is a Number, which is the ID of the highlight group
@@ -4197,8 +4217,6 @@ hlID({name}) The result is a Number, which is the ID of the highlight group
group. For example, to get the background color of the
"Comment" group: >
:echo synIDattr(synIDtrans(hlID("Comment")), "bg")
< *highlightID()*
Obsolete name: highlightID().
hostname() *hostname()*
The result is a String, which is the name of the machine on
@@ -4216,11 +4234,7 @@ iconv({expr}, {from}, {to}) *iconv()*
Most conversions require Vim to be compiled with the |+iconv|
feature. Otherwise only UTF-8 to latin1 conversion and back
can be done.
This can be used to display messages with special characters,
no matter what 'encoding' is set to. Write the message in
UTF-8 and use: >
echo iconv(utf8_str, "utf-8", &enc)
< Note that Vim uses UTF-8 for all Unicode encodings, conversion
Note that Vim uses UTF-8 for all Unicode encodings, conversion
from/to UCS-2 is automatically changed to use UTF-8. You
cannot use UCS-2 in a string anyway, because of the NUL bytes.
{only available when compiled with the |+multi_byte| feature}
@@ -4397,7 +4411,8 @@ jobclose({job}[, {stream}]) {Nvim} *jobclose()*
Close {job}'s {stream}, which can be one of "stdin", "stdout",
"stderr" or "rpc" (closes the rpc channel for a job started
with the "rpc" option.) If {stream} is omitted, all streams
are closed.
are closed. If the job is a pty job, this will then close the
pty master, sending SIGHUP to the job process.
jobpid({job}) {Nvim} *jobpid()*
Return the pid (process id) of {job}.
@@ -4504,9 +4519,7 @@ join({list} [, {sep}]) *join()*
json_decode({expr}) *json_decode()*
Convert {expr} from JSON object. Accepts |readfile()|-style
list as the input, as well as regular string. May output any
Vim value. When 'encoding' is not UTF-8 string is converted
from UTF-8 to 'encoding', failing conversion fails
json_decode(). In the following cases it will output
Vim value. In the following cases it will output
|msgpack-special-dict|:
1. Dictionary contains duplicate key.
2. Dictionary contains empty key.
@@ -4514,33 +4527,22 @@ json_decode({expr}) *json_decode()*
dictionary and for string will be emitted in case string
with NUL byte was a dictionary key.
Note: function treats its input as UTF-8 always regardless of
'encoding' value. This is needed because JSON source is
supposed to be external (e.g. |readfile()|) and JSON standard
allows only a few encodings, of which UTF-8 is recommended and
the only one required to be supported. Non-UTF-8 characters
are an error.
Note: function treats its input as UTF-8 always. The JSON
standard allows only a few encodings, of which UTF-8 is
recommended and the only one required to be supported.
Non-UTF-8 characters are an error.
json_encode({expr}) *json_encode()*
Convert {expr} into a JSON string. Accepts
|msgpack-special-dict| as the input. Converts from 'encoding'
to UTF-8 when encoding strings. Will not convert |Funcref|s,
|msgpack-special-dict| as the input. Will not convert |Funcref|s,
mappings with non-string keys (can be created as
|msgpack-special-dict|), values with self-referencing
containers, strings which contain non-UTF-8 characters,
pseudo-UTF-8 strings which contain codepoints reserved for
surrogate pairs (such strings are not valid UTF-8 strings).
When converting 'encoding' is taken into account, if it is not
"utf-8", then conversion is performed before encoding strings.
Non-printable characters are converted into "\u1234" escapes
or special escapes like "\t", other are dumped as-is.
Note: all characters above U+0079 are considered non-printable
when 'encoding' is not UTF-8. This function always outputs
UTF-8 strings as required by the standard thus when 'encoding'
is not unicode resulting string will look incorrect if
"\u1234" notation is not used.
keys({dict}) *keys()*
Return a |List| with all the keys of {dict}. The |List| is in
arbitrary order.
@@ -4642,9 +4644,9 @@ line2byte({lnum}) *line2byte()*
Return the byte count from the start of the buffer for line
{lnum}. This includes the end-of-line character, depending on
the 'fileformat' option for the current buffer. The first
line returns 1. 'encoding' matters, 'fileencoding' is ignored.
This can also be used to get the byte count for the line just
below the last line: >
line returns 1. UTF-8 encoding is used, 'fileencoding' is
ignored. This can also be used to get the byte count for the
line just below the last line: >
line2byte(line("$") + 1)
< This is the buffer size plus one. If 'fileencoding' is empty
it is the file size plus one.
@@ -5068,7 +5070,7 @@ msgpackdump({list}) {Nvim} *msgpackdump()*
(dictionary with zero items is represented by 0x80 byte in
messagepack).
Limitations: *E951* *E952* *E953*
Limitations: *E5004* *E5005*
1. |Funcref|s cannot be dumped.
2. Containers that reference themselves cannot be dumped.
3. Dictionary keys are always dumped as STR strings.
@@ -5163,15 +5165,26 @@ nr2char({expr}[, {utf8}]) *nr2char()*
value {expr}. Examples: >
nr2char(64) returns "@"
nr2char(32) returns " "
< When {utf8} is omitted or zero, the current 'encoding' is used.
Example for "utf-8": >
< Example for "utf-8": >
nr2char(300) returns I with bow character
< With {utf8} set to 1, always return utf-8 characters.
< UTF-8 encoding is always used, {utf8} option has no effect,
and exists only for backwards-compatibility.
Note that a NUL character in the file is specified with
nr2char(10), because NULs are represented with newline
characters. nr2char(0) is a real NUL and terminates the
string, thus results in an empty string.
nvim_...({...}) *nvim_...()* *eval-api*
Call nvim |api| functions. The type checking of arguments will
be stricter than for most other builtins. For instance,
if Integer is expected, a |Number| must be passed in, a
|String| will not be autoconverted.
Buffer numbers, as returned by |bufnr()| could be used as
first argument to nvim_buf_... functions. All functions
expecting an object (buffer, window or tabpage) can
also take the numerical value 0 to indicate the current
(focused) object.
or({expr}, {expr}) *or()*
Bitwise OR on the two arguments. The arguments are converted
to a number. A List, Dict or Float argument causes an error.
@@ -5397,7 +5410,7 @@ py3eval({expr}) *py3eval()*
converted to Vim data structures.
Numbers and strings are returned as they are (strings are
copied though, Unicode strings are additionally converted to
'encoding').
UTF-8).
Lists are represented as Vim |List| type.
Dictionaries are represented as Vim |Dictionary| type with
keys converted to strings.
@@ -5447,8 +5460,7 @@ readfile({fname} [, {binary} [, {max}]])
Otherwise:
- CR characters that appear before a NL are removed.
- Whether the last line ends in a NL or not does not matter.
- When 'encoding' is Unicode any UTF-8 byte order mark is
removed from the text.
- Any UTF-8 byte order mark is removed from the text.
When {max} is given this specifies the maximum number of lines
to be read. Useful if you only want to check the first ten
lines of a file: >
@@ -5470,14 +5482,20 @@ reltime([{start} [, {end}]]) *reltime()*
the item depends on the system. It can be passed to
|reltimestr()| to convert it to a string or |reltimefloat()|
to convert to a float.
Without an argument it returns the current time.
With one argument is returns the time passed since the time
Without an argument it returns the current "relative time", an
implementation-defined value meaningful only when used as an
argument to |reltime()|, |reltimestr()| and |reltimefloat()|.
With one argument it returns the time passed since the time
specified in the argument.
With two arguments it returns the time passed between {start}
and {end}.
The {start} and {end} arguments must be values returned by
reltime().
Note: |localtime()| returns the current (non-relative) time.
reltimefloat({time}) *reltimefloat()*
Return a Float that represents the time value of {time}.
Unit of time is seconds.
@@ -5664,8 +5682,7 @@ rpcstart({prog}[, {argv}]) {Nvim} *rpcstart()*
Deprecated. Replace >
:let id = rpcstart('prog', ['arg1', 'arg2'])
< with >
:let id = jobstart(['prog', 'arg1', 'arg2'],
{'rpc': v:true})
:let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
rpcstop({channel}) {Nvim} *rpcstop()*
Closes an |RPC| {channel}. If the channel is a job
@@ -6052,11 +6069,13 @@ setline({lnum}, {text}) *setline()*
setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()*
Create or replace or add to the location list for window {nr}.
When {nr} is zero the current window is used. For a location
list window, the displayed location list is modified. For an
invalid window number {nr}, -1 is returned. If {title} is
given, it will be used to set |w:quickfix_title| after opening
the location window.
{nr} can be the window number or the window ID.
When {nr} is zero the current window is used.
For a location list window, the displayed location list is
modified. For an invalid window number {nr}, -1 is returned. If
{title} is given, it will be used to set |w:quickfix_title|
after opening the location window.
Otherwise, same as |setqflist()|.
Also see |location-list|.
@@ -6145,12 +6164,18 @@ setqflist({list} [, {action}[, {title}]]) *setqflist()*
Note that the list is not exactly the same as what
|getqflist()| returns.
*E927*
If {action} is set to 'a', then the items from {list} are
added to the existing quickfix list. If there is no existing
list, then a new list is created. If {action} is set to 'r',
then the items from the current quickfix list are replaced
with the items from {list}. If {action} is not present or is
set to ' ', then a new list is created.
list, then a new list is created.
If {action} is set to 'r', then the items from the current
quickfix list are replaced with the items from {list}. This
can also be used to clear the list: >
:call setqflist([], 'r')
<
If {action} is not present or is set to ' ', then a new list
is created.
If {title} is given, it will be used to set |w:quickfix_title|
after opening the quickfix window.
@@ -6220,6 +6245,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
{val}.
Tabs are numbered starting with one. For the current tabpage
use |setwinvar()|.
{winnr} can be the window number or the window ID.
When {winnr} is zero the current window is used.
This also works for a global or local buffer option, but it
doesn't work for a global or local buffer variable.
@@ -6592,8 +6618,7 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
for infinite and NaN floating-point values representations
which use |str2float()|. Strings are also dumped literally,
only single quote is escaped, which does not allow using YAML
for parsing back binary strings (including text when
'encoding' is not UTF-8). |eval()| should always work for
for parsing back binary strings. |eval()| should always work for
strings and floats though and this is the only official
method, use |msgpackdump()| or |json_encode()| if you need to
share data with other application.
@@ -6811,23 +6836,30 @@ system({cmd} [, {input}]) *system()* *E677*
Get the output of the shell command {cmd} as a |string|. {cmd}
will be run the same as in |jobstart()|. See |systemlist()|
to get the output as a |List|.
Not to be used for interactive commands.
When {input} is given and is a string this string is written
to a file and passed as stdin to the command. The string is
written as-is, you need to take care of using the correct line
separators yourself.
If {input} is given and is a |List| it is written to the file
in a way |writefile()| does with {binary} set to "b" (i.e.
with a newline between each list item with newlines inside
list items converted to NULs).
Pipes are not used.
If {input} is a string it is written to a pipe and passed as
stdin to the command. The string is written as-is, line
separators are not changed.
If {input} is a |List| it is written to the pipe as
|writefile()| does with {binary} set to "b" (i.e. with
a newline between each list item, and newlines inside list
items converted to NULs).
*E5677*
Note: system() cannot write to or read from backgrounded ("&")
shell commands, e.g.: >
:echo system("cat - &", "foo"))
< which is equivalent to: >
$ echo foo | bash -c 'cat - &'
< The pipes are disconnected (unless overridden by shell
redirection syntax) before input can reach it. Use
|jobstart()| instead.
Note: Use |shellescape()| or |::S| with |expand()| or
|fnamemodify()| to escape special characters in a command
argument. Newlines in {cmd} may cause the command to fail.
The characters in 'shellquote' and 'shellxquote' may also
cause trouble.
This is not to be used for interactive commands.
The result is a String. Example: >
:let files = system("ls " . shellescape(expand('%:h')))
@@ -6842,9 +6874,6 @@ system({cmd} [, {input}]) *system()* *E677*
The command executed is constructed using several options when
{cmd} is a string: 'shell' 'shellcmdflag' {cmd}
The command will be executed in "cooked" mode, so that a
CTRL-C will interrupt the command (on Unix at least).
The resulting error code can be found in |v:shell_error|.
This function will fail in |restricted-mode|.
@@ -7017,8 +7046,9 @@ timer_start({time}, {callback} [, {options}])
{only available when compiled with the |+timers| feature}
timer_stop({timer}) *timer_stop()*
Stop a timer. {timer} is an ID returned by timer_start().
The timer callback will no longer be invoked.
Stop a timer. The timer callback will no longer be invoked.
{timer} is an ID returned by timer_start(), thus it must be a
Number.
tolower({expr}) *tolower()*
The result is a copy of the String given, with all uppercase
@@ -7219,6 +7249,10 @@ wildmenumode() *wildmenumode()*
(Note, this needs the 'wildcharm' option set appropriately).
win_findbuf({bufnr}) *win_findbuf()*
Returns a list with window IDs for windows that contain buffer
{bufnr}. When there is none the list is empty.
win_getid([{win} [, {tab}]]) *win_getid()*
Get the window ID for the specified window.
When {win} is missing use the current window.
@@ -7244,9 +7278,11 @@ win_id2win({expr}) *win_id2win()*
*winbufnr()*
winbufnr({nr}) The result is a Number, which is the number of the buffer
associated with window {nr}. When {nr} is zero, the number of
the buffer in the current window is returned. When window
{nr} doesn't exist, -1 is returned.
associated with window {nr}. {nr} can be the window number or
the window ID.
When {nr} is zero, the number of the buffer in the current
window is returned.
When window {nr} doesn't exist, -1 is returned.
Example: >
:echo "The file in the current window is " . bufname(winbufnr(0))
<
@@ -7257,6 +7293,7 @@ wincol() The result is a Number, which is the virtual column of the
winheight({nr}) *winheight()*
The result is a Number, which is the height of window {nr}.
{nr} can be the window number or the window ID.
When {nr} is zero, the height of the current window is
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a height of zero or more.
@@ -7336,6 +7373,7 @@ winsaveview() Returns a |Dictionary| that contains information to restore
winwidth({nr}) *winwidth()*
The result is a Number, which is the width of window {nr}.
{nr} can be the window number or the window ID.
When {nr} is zero, the width of the current window is
returned. When window {nr} doesn't exist, -1 is returned.
An existing window always has a width of zero or more.
@@ -7411,7 +7449,11 @@ There are four types of features:
Example: >
:if has("gui_running")
< *has-patch*
3. Included patches. The "patch123" feature means that patch 123 has been
3. {Nvim} version. The "nvim-1.2.3" feature means that the Nvim version is
1.2.3 or later. Example: >
:if has("nvim-1.2.3")
<
4. Included patches. The "patch123" feature means that patch 123 has been
included. Note that this form does not check the version of Vim, you need
to inspect |v:version| for that.
Example (checking version 6.2.148 or later): >
@@ -7419,7 +7461,7 @@ There are four types of features:
< Note that it's possible for patch 147 to be omitted even though 148 is
included.
4. Beyond a certain version or at a certain version and including a specific
5. Beyond a certain version or at a certain version and including a specific
patch. The "patch-7.4.237" feature means that the Vim version is 7.5 or
later, or it is version 7.4 and patch 237 was included.
Note that this only works for patch 7.4.237 and later, before that you
@@ -7491,6 +7533,7 @@ multi_byte Compiled with support for 'encoding'
multi_byte_encoding 'encoding' is set to a multi-byte encoding.
multi_byte_ime Compiled with support for IME input method.
multi_lang Compiled with support for multiple languages.
nvim This is Nvim. |has-patch|
ole Compiled with OLE automation support for Win32.
path_extra Compiled with up/downwards search in 'path' and 'tags'
persistent_undo Compiled with support for persistent undo history.

View File

@@ -529,14 +529,12 @@ Man {sect} {name}({sect}) Used during completion to show the real section of
when the provided section is a prefix, e.g. 1m vs 1.
Man {path} Open the manpage specified by path. Prepend "./" if
page is in the current directory.
Man Open the manpage for the <cWORD> (man buffers)
or <cword> (non-man buffers) under the cursor.
|:Man| accepts command modifiers. For example, to use a vertical split: >
:vertical Man printf
Global Mappings:
<Plug>(Man) Jump to the manpage for the <cWORD> under the
cursor. Takes a count for the section.
Local mappings:
K or CTRL-] Jump to the manpage for the <cWORD> under the
cursor. Takes a count for the section.
@@ -547,6 +545,9 @@ q :quit if invoked as $MANPAGER, otherwise :close.
Variables:
*g:no_man_maps* Do not create mappings in manpage buffers.
*g:ft_man_folding_enable* Fold manpages with foldmethod=indent foldnestmax=1.
*b:man_default_sects* Comma-separated, ordered list of preferred sections.
For example in C one usually wants section 3 or 2: >
:let b:man_default_sections = '3,2'
PDF *ft-pdf-plugin*

View File

@@ -128,6 +128,7 @@ The available subcommands are:
6 or e: Find this egrep pattern
7 or f: Find this file
8 or i: Find files #including this file
9 or a: Find places where this symbol is assigned a value
For all types, except 4 and 6, leading white space for {name} is
removed. For 4 and 6 there is exactly one space between {querytype}
@@ -254,13 +255,13 @@ started will have no effect!
{not available when compiled without the |+quickfix| feature}
'cscopequickfix' specifies whether to use quickfix window to show cscope
results. This is a list of comma-separated values. Each item consists of
|cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0).
|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0).
'+' indicates that results must be appended to quickfix window,
'-' implies previous results clearance, '0' or command absence - don't use
quickfix. Search is performed from start until first command occurrence.
The default value is "" (don't use quickfix anyway). The following value
seems to be useful: >
:set cscopequickfix=s-,c-,d-,i-,t-,e-
:set cscopequickfix=s-,c-,d-,i-,t-,e-,a-
<
*cscopetag* *cst*
If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t"
@@ -418,6 +419,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>a :cs find a <C-R>=expand("<cword>")<CR><CR>
" Using 'CTRL-spacebar' then a search type makes the vim window
" split horizontally, with search result displayed in
@@ -431,6 +433,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space>a :scs find a <C-R>=expand("<cword>")<CR><CR>
" Hitting CTRL-space *twice* before the search type does a vertical
" split instead of a horizontal one
@@ -449,6 +452,8 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-Space><C-Space>d
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
nmap <C-Space><C-Space>a
\:vert scs find a <C-R>=expand("<cword>")<CR><CR>
==============================================================================
7. Cscope availability and information *cscope-info*

View File

@@ -1436,7 +1436,7 @@ original HTML files completion of tags (and only tags) isn't context aware.
RUBY *ft-ruby-omni* {Nvim}
NOTE: Completion for ruby code is not currently provided by Nvim.
NOTE: |compl-omni| for Ruby code requires |provider-ruby| to be installed.
Ruby completion will parse your buffer on demand in order to provide a list of
completions. These completions will be drawn from modules loaded by 'require'

View File

@@ -450,7 +450,7 @@ notation meaning equivalent decimal value(s) ~
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
<S-...> shift-key *shift* *<S-*
<C-...> control-key *control* *ctrl* *<C-*
<M-...> alt-key or meta-key *meta* *alt* *<M-*
<M-...> alt-key or meta-key *META* *meta* *alt* *<M-*
<A-...> same as <M-...> *<A-*
<D-...> command-key or "super" key *<D-*
<t_xx> key with "xx" entry in termcap

View File

@@ -1406,6 +1406,27 @@ The valid escape sequences are
<bang> (See the '-bang' attribute) Expands to a ! if the
command was executed with a ! modifier, otherwise
expands to nothing.
*<mods>*
<mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |aboveleft|, |belowright|,
|botright|, |browse|, |confirm|, |hide|, |keepalt|,
|keepjumps|, |keepmarks|, |keeppatterns|, |lockmarks|,
|noswapfile|, |silent|, |tab|, |topleft|, |verbose|, and
|vertical|.
Examples: >
command! -nargs=+ -complete=file MyEdit
\ for f in expand(<q-args>, 0, 1) |
\ exe '<mods> split ' . f |
\ endfor
function! SpecialEdit(files, mods)
for f in expand(a:files, 0, 1)
exe a:mods . ' split ' . f
endfor
endfunction
command! -nargs=+ -complete=file Sedit
\ call SpecialEdit(<q-args>, <q-mods>)
<
*<reg>* *<register>*
<reg> (See the '-register' attribute) The optional register,
if specified. Otherwise, expands to nothing. <register>

View File

@@ -70,29 +70,24 @@ See |mbyte-locale| for details.
ENCODING
If your locale works properly, Vim will try to set the 'encoding' option
accordingly. If this doesn't work you can overrule its value: >
Nvim always uses UTF-8 internally. Thus 'encoding' option is always set
to "utf-8" and cannot be changed.
:set encoding=utf-8
All the text that is used inside Vim will be in UTF-8. Not only the text in
the buffers, but also in registers, variables, etc.
See |encoding-values| for a list of acceptable values.
The result is that all the text that is used inside Vim will be in this
encoding. Not only the text in the buffers, but also in registers, variables,
etc. 'encoding' is read-only after startup because changing it would make the
existing text invalid.
You can edit files in another encoding than what 'encoding' is set to. Vim
You can edit files in different encodings than UTF-8. Nvim
will convert the file when you read it and convert it back when you write it.
See 'fileencoding', 'fileencodings' and |++enc|.
DISPLAY AND FONTS
If you are working in a terminal (emulator) you must make sure it accepts the
same encoding as which Vim is working with.
If you are working in a terminal (emulator) you must make sure it accepts
UTF-8, the encoding which Vim is working with. Otherwise only ASCII can
be displayed and edited correctly.
For the GUI you must select fonts that work with the current 'encoding'. This
For the GUI you must select fonts that work with UTF-8. This
is the difficult part. It depends on the system you are using, the locale and
a few other things. See the chapters on fonts: |mbyte-fonts-X11| for
X-Windows and |mbyte-fonts-MSwin| for MS-Windows.
@@ -216,10 +211,9 @@ You could make a small shell script for this.
==============================================================================
3. Encoding *mbyte-encoding*
Vim uses the 'encoding' option to specify how characters are identified and
encoded when they are used inside Vim. This applies to all the places where
text is used, including buffers (files loaded into memory), registers and
variables.
In Nvim UTF-8 is always used internally to encode characters.
This applies to all the places where text is used, including buffers (files
loaded into memory), registers and variables.
*charset* *codeset*
Charset is another name for encoding. There are subtle differences, but these
@@ -240,7 +234,7 @@ matter what language is used. Thus you might see the right text even when the
encoding was set wrong.
*encoding-names*
Vim can use many different character encodings. There are three major groups:
Vim can edit files in different character encodings. There are three major groups:
1 8bit Single-byte encodings, 256 different characters. Mostly used
in USA and Europe. Example: ISO-8859-1 (Latin1). All
@@ -255,11 +249,10 @@ u Unicode Universal encoding, can replace all others. ISO 10646.
Millions of different characters. Example: UTF-8. The
relation between bytes and screen cells is complex.
Other encodings cannot be used by Vim internally. But files in other
Only UTF-8 is used by Vim internally. But files in other
encodings can be edited by using conversion, see 'fileencoding'.
Note that all encodings must use ASCII for the characters up to 128.
Supported 'encoding' values are: *encoding-values*
Recognized 'fileencoding' values include: *encoding-values*
1 latin1 8-bit characters (ISO 8859-1, also used for cp1252)
1 iso-8859-n ISO_8859 variant (n = 2 to 15)
1 koi8-r Russian
@@ -311,11 +304,11 @@ u ucs-4 32 bit UCS-4 encoded Unicode (ISO/IEC 10646-1)
u ucs-4le like ucs-4, little endian
The {name} can be any encoding name that your system supports. It is passed
to iconv() to convert between the encoding of the file and the current locale.
to iconv() to convert between UTF-8 and the encoding of the file.
For MS-Windows "cp{number}" means using codepage {number}.
Examples: >
:set encoding=8bit-cp1252
:set encoding=2byte-cp932
:set fileencoding=8bit-cp1252
:set fileencoding=2byte-cp932
The MS-Windows codepage 1252 is very similar to latin1. For practical reasons
the same encoding is used and it's called latin1. 'isprint' can be used to
@@ -337,8 +330,7 @@ u ucs-2be same as ucs-2 (big endian)
u ucs-4be same as ucs-4 (big endian)
u utf-32 same as ucs-4
u utf-32le same as ucs-4le
default stands for the default value of 'encoding', depends on the
environment
default the encoding of the current locale.
For the UCS codes the byte order matters. This is tricky, use UTF-8 whenever
you can. The default is to use big-endian (most significant byte comes
@@ -363,13 +355,12 @@ or when conversion is not possible:
CONVERSION *charset-conversion*
Vim will automatically convert from one to another encoding in several places:
- When reading a file and 'fileencoding' is different from 'encoding'
- When writing a file and 'fileencoding' is different from 'encoding'
- When reading a file and 'fileencoding' is different from "utf-8"
- When writing a file and 'fileencoding' is different from "utf-8"
- When displaying messages and the encoding used for LC_MESSAGES differs from
'encoding' (requires a gettext version that supports this).
"utf-8" (requires a gettext version that supports this).
- When reading a Vim script where |:scriptencoding| is different from
'encoding'.
- When reading or writing a |shada| file.
"utf-8".
Most of these require the |+iconv| feature. Conversion for reading and
writing files may also be specified with the 'charconvert' option.
@@ -408,11 +399,11 @@ Useful utilities for converting the charset:
*mbyte-conversion*
When reading and writing files in an encoding different from 'encoding',
When reading and writing files in an encoding different from "utf-8",
conversion needs to be done. These conversions are supported:
- All conversions between Latin-1 (ISO-8859-1), UTF-8, UCS-2 and UCS-4 are
handled internally.
- For MS-Windows, when 'encoding' is a Unicode encoding, conversion from and
- For MS-Windows, conversion from and
to any codepage should work.
- Conversion specified with 'charconvert'
- Conversion with the iconv library, if it is available.
@@ -468,8 +459,6 @@ and you will have a working UTF-8 terminal emulator. Try both >
with the demo text that comes with ucs-fonts.tar.gz in order to see
whether there are any problems with UTF-8 in your xterm.
For Vim you may need to set 'encoding' to "utf-8".
==============================================================================
5. Fonts on X11 *mbyte-fonts-X11*
@@ -864,11 +853,11 @@ between two keyboard settings.
The value of the 'keymap' option specifies a keymap file to use. The name of
this file is one of these two:
keymap/{keymap}_{encoding}.vim
keymap/{keymap}_utf-8.vim
keymap/{keymap}.vim
Here {keymap} is the value of the 'keymap' option and {encoding} of the
'encoding' option. The file name with the {encoding} included is tried first.
Here {keymap} is the value of the 'keymap' option.
The file name with "utf-8" included is tried first.
'runtimepath' is used to find these files. To see an overview of all
available keymap files, use this: >
@@ -950,7 +939,7 @@ this is unusual. But you can use various ways to specify the character: >
A <char-0141> octal value
x <Space> special key name
The characters are assumed to be encoded for the current value of 'encoding'.
The characters are assumed to be encoded in UTF-8.
It's possible to use ":scriptencoding" when all characters are given
literally. That doesn't work when using the <char-> construct, because the
conversion is done on the keymap file, not on the resulting character.
@@ -1170,21 +1159,13 @@ Useful commands:
message is truncated, use ":messages").
- "g8" shows the bytes used in a UTF-8 character, also the composing
characters, as hex numbers.
- ":set encoding=utf-8 fileencodings=" forces using UTF-8 for all files. The
default is to use the current locale for 'encoding' and set 'fileencodings'
to automatically detect the encoding of a file.
- ":set fileencodings=" forces using UTF-8 for all files. The
default is to automatically detect the encoding of a file.
STARTING VIM
If your current locale is in an utf-8 encoding, Vim will automatically start
in utf-8 mode.
If you are using another locale: >
set encoding=utf-8
You might also want to select the font used for the menus. Unfortunately this
You might want to select the font used for the menus. Unfortunately this
doesn't always work. See the system specific remarks below, and 'langmenu'.
@@ -1245,10 +1226,9 @@ not everybody is able to type a composing character.
These options are relevant for editing multi-byte files. Check the help in
options.txt for detailed information.
'encoding' Encoding used for the keyboard and display. It is also the
default encoding for files.
'encoding' Internal text encoding, always "utf-8".
'fileencoding' Encoding of a file. When it's different from 'encoding'
'fileencoding' Encoding of a file. When it's different from "utf-8"
conversion is done when reading or writing the file.
'fileencodings' List of possible encodings of a file. When opening a file

View File

@@ -1,4 +1,4 @@
*message.txt* For Vim version 7.4. Last change: 2016 Feb 27
*message.txt* For Vim version 7.4. Last change: 2016 Jul 14
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -656,6 +656,12 @@ You must be using an awful lot of buffers. It's now possible that two buffers
have the same number, which causes various problems. You might want to exit
Vim and restart it.
*E931* >
Buffer cannot be registered
Out of memory or a duplicate buffer number. May habben after W14. Looking up
a buffer will not always work, better restart Vim.
*E296* *E297* >
Seek error in swap file write
Write error in swap file

View File

@@ -1,4 +1,4 @@
*motion.txt* For Vim version 7.4. Last change: 2015 Jun 06
*motion.txt* For Vim version 7.4. Last change: 2016 Jul 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -569,7 +569,7 @@ i[ "inner [] block", select [count] '[' ']' blocks. This
When used in Visual mode it is made characterwise.
a) *v_a)* *a)* *a(*
a( *v_ab* *v_a(* *ab*
a( *vab* *v_ab* *v_a(* *ab*
ab "a block", select [count] blocks, from "[count] [(" to
the matching ')', including the '(' and ')' (see
|[(|). Does not include white space outside of the
@@ -577,7 +577,7 @@ ab "a block", select [count] blocks, from "[count] [(" to
When used in Visual mode it is made characterwise.
i) *v_i)* *i)* *i(*
i( *v_ib* *v_i(* *ib*
i( *vib* *v_ib* *v_i(* *ib*
ib "inner block", select [count] blocks, from "[count] [("
to the matching ')', excluding the '(' and ')' (see
|[(|).

View File

@@ -11,6 +11,7 @@ RPC API for Nvim *RPC* *rpc* *msgpack-rpc*
3. Connecting |rpc-connecting|
4. Clients |rpc-api-client|
5. Types |rpc-types|
6. Remote UIs |rpc-remote-ui|
==============================================================================
1. Introduction *rpc-intro*
@@ -46,7 +47,7 @@ instance.
There are three ways to obtain API metadata:
1. Connect to a running Nvim instance and call `vim_get_api_info` via
1. Connect to a running Nvim instance and call `nvim_get_api_info` via
msgpack-rpc. This is best for clients written in dynamic languages which
can define functions at runtime.
@@ -104,7 +105,7 @@ Nvim instance:
require 'msgpack/rpc/transport/unix'
nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS'])
result = nvim.call(:vim_command, 'echo "hello world!"')
result = nvim.call(:nvim_command, 'echo "hello world!"')
<
A better way is to use the Python REPL with the `neovim` package, where API
functions can be called interactively:
@@ -116,24 +117,23 @@ functions can be called interactively:
You can also embed an Nvim instance via |jobstart()|, and communicate using
|rpcrequest()| and |rpcnotify()|:
>
let vim = jobstart(['nvim', '--embed'], {'rpc': v:true})
echo rpcrequest(vim, 'vim_eval', '"Hello " . "world!"')
call jobstop(vim)
let nvim = jobstart(['nvim', '--embed'], {'rpc': v:true})
echo rpcrequest(nvim, 'nvim_eval', '"Hello " . "world!"')
call jobstop(nvim)
<
==============================================================================
4. Implementing API clients *rpc-api-client* *api-client*
All external UIs and remote plugins (as opposed to regular Vim plugins) are
"clients" in general; but we call something an "API client" if its purpose is
to abstract or wrap the RPC API for the convenience of other applications
(just like a REST client or SDK such as boto3 for AWS: you can speak AWS REST
using an HTTP client like curl, but boto3 wraps that in a convenient python
interface). For example, the lua-client is an API client:
https://github.com/neovim/lua-client
"API clients" wrap the Nvim API to provide idiomatic "SDKs" for their
respective platforms (see |dev-jargon|). You can build a new API client for
your favorite platform or programming language.
The Python client (pip package "neovim") is the reference implementation of an
API client. It is always up-to-date with the Nvim API, so its source code and
test suite are an authoritative reference.
Existing API clients are listed here:
https://github.com/neovim/neovim/wiki/Related-projects#api-clients
The Python client is the reference implementation for API clients. It is
always up-to-date with the Nvim API, so its source code and test suite are
authoritative references.
https://github.com/neovim/python-client
API client implementation guidelines ~
@@ -168,6 +168,8 @@ API metadata object ~
API clients exist to hide msgpack-rpc details. The API metadata object
contains information that makes this task easier (see also |rpc-types|):
- The "version" key contains the Nvim version, API level, and API
backwards-compatibility level.
- The "functions" key contains a list of metadata objects for individual
functions.
- Each function metadata object has |rpc-types| information about the return
@@ -176,15 +178,20 @@ contains information that makes this task easier (see also |rpc-types|):
- Container types may be decorated with type/size constraints, e.g.
ArrayOf(Buffer) or ArrayOf(Integer, 2). This can be useful to generate
even more strongly-typed APIs.
- Methods that operate on instances of Nvim special types (msgpack EXT) are
prefixed with the type name in lower case, e.g. `buffer_get_line`
represents the `get_line` method of a Buffer instance.
- Global methods are prefixed with `vim`, e.g. `vim_get_buffers`.
- Functions that are considered to be methods that operate on instances of
Nvim special types (msgpack EXT) will have the `"method"` attribute set to
`true`. The reciever type is the type of the first argument. The method
names are prefixed with `nvim_` plus a shortened type name, e.g.
`nvim_buf_get_lines` represents the `get_lines` method of a Buffer instance.
- Global functions have `"method"` set to `false` and are prefixed with just
`nvim_`, e.g. `nvim_get_buffers`.
So for an object-oriented language, an API client contains the classes
representing Nvim special types, and the methods of each class could be
defined by inspecting the method name prefix. There could also be a singleton
Vim class with methods mapped to functions prefixed with `vim_`.
defined by stripping the prefix for the type as defined in the `types` metadata
(this will always be the first two "_"-separated parts of the function name).
There could also be a singleton Vim class with methods where the `nvim_`
prefix is stripped off.
==============================================================================
5. Types *rpc-types*
@@ -218,18 +225,21 @@ an integer, but not a Window or Tabpage.
The most reliable way of determining the type codes for the special Nvim types
is to inspect the `types` key of metadata dictionary returned by the
`vim_get_api_info` method at runtime. Here's a sample JSON representation of
`nvim_get_api_info` method at runtime. Here's a sample JSON representation of
the `types` object:
>
"types": {
"Buffer": {
"id": 0
"id": 0,
"prefix": "nvim_buf_"
},
"Window": {
"id": 1
"id": 1,
"prefix": "nvim_win_"
},
"Tabpage": {
"id": 2
"id": 2,
"prefix": "nvim_tabpage_"
}
}
<
@@ -237,5 +247,170 @@ Even for statically compiled clients it is good practice to avoid hardcoding
the type codes, because a client may be built against one Nvim version but
connect to another with different type codes.
==============================================================================
6. Remote UIs *rpc-remote-ui*
Nvim allows Graphical user interfaces to be implemented by separate processes
communicating with Nvim over the RPC API. Currently the ui model conists of a
terminal-like grid with one single, monospace font size, with a few elements
that could be drawn separately from the grid (for the momemnt only the popup
menu)
After connecting to a nvim instance (typically a spawned, embedded instance)
use the |nvim_ui_attach|(width, height, options) API method to tell nvim that your
program wants to draw the nvim screen on a grid with "width" times
"height" cells. "options" should be a dictionary with the following (all
optional) keys:
`rgb`: Controls what color format to use.
Set to true (default) to use 24-bit rgb
colors.
Set to false to use terminal color codes (at
most 256 different colors).
`popupmenu_external`: Instead of drawing the completion popupmenu on
the grid, Nvim will send higher-level events to
the ui and let it draw the popupmenu.
Defaults to false.
Nvim will then send msgpack-rpc notifications, with the method name "redraw"
and a single argument, an array of screen updates (described below).
These should be processed in order. Preferably the user should only be able to
see the screen state after all updates are processed (not any intermediate
state after processing only a part of the array).
Screen updates are arrays. The first element a string describing the kind
of update.
["resize", width, height]
The grid is resized to `width` and `height` cells.
["clear"]
Clear the screen.
["eol_clear"]
Clear from the cursor position to the end of the current line.
["cursor_goto", row, col]
Move the cursor to position (row, col). Currently, the same cursor is
used to define the position for text insertion and the visible cursor.
However, only the last cursor position, after processing the entire
array in the "redraw" event, is intended to be a visible cursor
position.
["update_fg", color]
["update_bg", color]
["update_sp", color]
Set the default foreground, background and special colors
respectively.
["highlight_set", attrs]
Set the attributes that the next text put on the screen will have.
`attrs` is a dict with the keys below. Any absent key is reset
to its default value. Color defaults are set by the `update_fg` etc
updates. All boolean keys default to false.
`foreground`: foreground color.
`background`: backround color.
`special`: color to use for underline and undercurl, when present.
`reverse`: reverse video. Foreground and background colors are
switched.
`italic`: italic text.
`bold`: bold text.
`underline`: underlined text. The line has `special` color.
`undercurl`: undercurled text. The curl has `special` color.
["put", text]
The (utf-8 encoded) string `text` is put at the cursor position
(and the cursor is advanced), with the highlights as set by the
last `highlight_set` update.
["set_scroll_region", top, bot, left, right]
Define the scroll region used by `scroll` below.
["scroll", count]
Scroll the text in the scroll region. The diagrams below illustrate
what will happen, depending on the scroll direction. "=" is used to
represent the SR(scroll region) boundaries and "-" the moved rectangles.
Note that dst and src share a common region.
If count is bigger than 0, move a rectangle in the SR up, this can
happen while scrolling down.
>
+-------------------------+
| (clipped above SR) | ^
|=========================| dst_top |
| dst (still in SR) | |
+-------------------------+ src_top |
| src (moved up) and dst | |
|-------------------------| dst_bot |
| src (cleared) | |
+=========================+ src_bot
<
If count is less than zero, move a rectangle in the SR down, this can
happen while scrolling up.
>
+=========================+ src_top
| src (cleared) | |
|------------------------ | dst_top |
| src (moved down) and dst| |
+-------------------------+ src_bot |
| dst (still in SR) | |
|=========================| dst_bot |
| (clipped below SR) | v
+-------------------------+
<
["set_title", title]
["set_icon", icon]
Set the window title, and icon (minimized) window title, respectively.
In windowing systems not distinguishing between the two, "set_icon"
can be ignored.
["mouse_on"]
["mouse_off"]
Tells the client whether mouse support, as determined by |'mouse'|
option, is considered to be active in the current mode. This is mostly
useful for a terminal frontend, or other situations where nvim mouse
would conflict with other usages of the mouse. It is safe for a client
to ignore this and always send mouse events.
["busy_on"]
["busy_off"]
Nvim started or stopped being busy, and possibly not responsible to user
input. This could be indicated to the user by hiding the cursor.
["suspend"]
|:suspend| command or |Ctrl-Z| mapping is used. A terminal client (or other
client where it makes sense) could suspend itself. Other clients can
safely ignore it.
["bell"]
["visual_bell"]
Notify the user with an audible or visual bell, respectively.
["update_menu"]
The menu mappings changed.
["mode_change", mode]
The mode changed. Currently sent when "insert", "replace" and "normal"
modes are entered. A client could for instance change the cursor shape.
["popupmenu_show", items, selected, row, col]
When `popupmenu_external` is set to true, nvim will not draw the
popupmenu on the grid, instead when the popupmenu is to be displayed
this update is sent. `items` is an array of the items to show, the
items are themselves arrays of the form [word, kind, menu, info]
as defined at |complete-items|, except that `word` is replaced by
`abbr` if present. `selected` is the initially selected item, either a
zero-based index into the array of items, or -1 if no item is
selected. `row` and `col` is the anchor position, where the first
character of the completed word will be.
["popupmenu_select", selected]
An item in the currently displayed popupmenu is selected. `selected`
is either a zero-based index into the array of items from the last
`popupmenu_show` event, or -1 if no item is selected.
["popupmenu_hide"]
The popupmenu is hidden.
==============================================================================
vim:tw=78:ts=8:noet:ft=help:norl:

View File

@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.4. Last change: 2016 Apr 12
*options.txt* For Vim version 7.4. Last change: 2016 Jul 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -52,7 +52,6 @@ achieve special effects. These options come in three forms:
:se[t] all& Set all options to their default value. The values of
these options are not changed:
'columns'
'encoding'
'lines'
Warning: This may have a lot of side effects.
@@ -497,6 +496,7 @@ For example, to use a modeline only for Vim 7.0:
To use a modeline for Vim after version 7.2:
/* vim>702: set cole=2: */ ~
There can be no blanks between "vim" and the ":".
The modeline is ignored if {vers} does not fit in an integer. {Nvim}
The number of lines that are checked can be set with the 'modelines' option.
@@ -614,7 +614,6 @@ A jump table for the options with a short description can be found at |Q_op|.
global
{only available when compiled with the |+multi_byte|
feature}
Only effective when 'encoding' is "utf-8" or another Unicode encoding.
Tells Vim what to do with characters with East Asian Width Class
Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek
letters, Cyrillic letters).
@@ -667,7 +666,6 @@ A jump table for the options with a short description can be found at |Q_op|.
- Set the 'keymap' option to "arabic"; in Insert mode CTRL-^ toggles
between typing English and Arabic key mapping.
- Set the 'delcombine' option
Note that 'encoding' must be "utf-8" for working with Arabic text.
Resetting this option will:
- Reset the 'rightleft' option.
@@ -899,7 +897,7 @@ A jump table for the options with a short description can be found at |Q_op|.
- The backup file will be created in the first directory in the list
where this is possible. The directory must exist, Vim will not
create it for you.
- Empty means that no backup file will be created ( 'patchmode' is
- Empty means that no backup file will be created ('patchmode' is
impossible!). Writing may fail because of this.
- A directory "." means to put the backup file in the same directory
as the edited file.
@@ -1077,8 +1075,7 @@ A jump table for the options with a short description can be found at |Q_op|.
{not available when compiled without the |+linebreak|
feature}
This option lets you choose which characters might cause a line
break if 'linebreak' is on. Only works for ASCII and also for 8-bit
characters when 'encoding' is an 8-bit encoding.
break if 'linebreak' is on. Only works for ASCII characters.
*'breakindent'* *'bri'*
'breakindent' 'bri' boolean (default off)
@@ -1158,21 +1155,14 @@ A jump table for the options with a short description can be found at |Q_op|.
*'buftype'* *'bt'* *E382*
'buftype' 'bt' string (default: "")
local to buffer
{not available when compiled without the |+quickfix|
feature}
The value of this option specifies the type of a buffer:
<empty> normal buffer
nofile buffer which is not related to a file and will not be
written
nowrite buffer which will not be written
acwrite buffer which will always be written with BufWriteCmd
autocommands.
quickfix quickfix buffer, contains list of errors |:cwindow|
or list of locations |:lwindow|
help help buffer (you are not supposed to set this
manually)
terminal terminal buffer, this is set automatically when a
terminal is created. |terminal-emulator|
acwrite buffer will always be written with |BufWriteCmd|s
help help buffer (do not set this manually)
nofile buffer is not related to a file, will not be written
nowrite buffer will not be written
quickfix list of errors |:cwindow| or locations |:lwindow|
terminal |terminal-emulator| buffer
This option is used together with 'bufhidden' and 'swapfile' to
specify special kinds of buffers. See |special-buffers|.
@@ -1213,11 +1203,9 @@ A jump table for the options with a short description can be found at |Q_op|.
Specifies details about changing the case of letters. It may contain
these words, separated by a comma:
internal Use internal case mapping functions, the current
locale does not change the case mapping. This only
matters when 'encoding' is a Unicode encoding,
"latin1" or "iso-8859-15". When "internal" is
omitted, the towupper() and towlower() system library
functions are used when available.
locale does not change the case mapping. When
"internal" is omitted, the towupper() and towlower()
system library functions are used when available.
keepascii For the ASCII characters (0x00 to 0x7f) use the US
case mapping, the current locale is not effective.
This probably only matters for Turkish.
@@ -1270,13 +1258,12 @@ A jump table for the options with a short description can be found at |Q_op|.
file to convert from. You will have to save the text in a file first.
The expression must return zero or an empty string for success,
non-zero for failure.
The possible encoding names encountered are in 'encoding'.
See |encoding-names| for possible encoding names.
Additionally, names given in 'fileencodings' and 'fileencoding' are
used.
Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8"
is done internally by Vim, 'charconvert' is not used for this.
'charconvert' is also used to convert the shada file, if 'encoding' is
not "utf-8". Also used for Unicode conversion.
Also used for Unicode conversion.
Example: >
set charconvert=CharConvert()
fun CharConvert()
@@ -1291,8 +1278,6 @@ A jump table for the options with a short description can be found at |Q_op|.
v:fname_in name of the input file
v:fname_out name of the output file
Note that v:fname_in and v:fname_out will never be the same.
Note that v:charconvert_from and v:charconvert_to may be different
from 'encoding'. Vim internally uses UTF-8 instead of UCS-2 or UCS-4.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
@@ -1449,9 +1434,6 @@ A jump table for the options with a short description can be found at |Q_op|.
comment text. Currently only used to add markers for folding, see
|fold-marker|.
*'compatible'* *'cp'* *'nocompatible'* *'nocp'*
'compatible' 'cp' Removed. |vim-differences| {Nvim}
*'complete'* *'cpt'* *E535*
'complete' 'cpt' string (default: ".,w,b,u,t")
local to buffer
@@ -1459,7 +1441,7 @@ A jump table for the options with a short description can be found at |Q_op|.
when CTRL-P or CTRL-N are used. It is also used for whole-line
completion |i_CTRL-X_CTRL-L|. It indicates the type of completion
and the places to scan. It is a comma separated list of flags:
. scan the current buffer ( 'wrapscan' is ignored)
. scan the current buffer ('wrapscan' is ignored)
w scan buffers from other windows
b scan other loaded buffers that are in the buffer list
u scan the unloaded buffers that are in the buffer list
@@ -1848,9 +1830,6 @@ A jump table for the options with a short description can be found at |Q_op|.
the cursor would skip over it and jump to the
following occurrence.
*'cryptmethod'* *'cm'*
'cryptmethod' Removed. |vim-differences| {Nvim}
*'cscopepathcomp'* *'cspc'*
'cscopepathcomp' 'cspc' number (default 0)
global
@@ -2116,11 +2095,17 @@ A jump table for the options with a short description can be found at |Q_op|.
Change the way text is displayed. This is comma separated list of
flags:
lastline When included, as much as possible of the last line
in a window will be displayed. When not included, a
last line that doesn't fit is replaced with "@" lines.
in a window will be displayed. "@@@" is put in the
last columns of the last screen line to indicate the
rest of the line is not displayed.
truncate Like "lastline", but "@@@" is displayed in the first
column of the last screen line. Overrules "lastline".
uhex Show unprintable characters hexadecimal as <xx>
instead of using ^C and ~C.
When neither "lastline" or "truncate" is included, a last line that
doesn't fit is replaced with "@" lines.
*'eadirection'* *'ead'*
'eadirection' 'ead' string (default "both")
global
@@ -2129,48 +2114,24 @@ A jump table for the options with a short description can be found at |Q_op|.
hor horizontally, height of windows is not affected
both width and height of windows is affected
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
'edcompatible' 'ed' Removed. |vim-differences| {Nvim}
*'encoding'* *'enc'* *E543*
'encoding' 'enc' string (default: "utf-8")
*'emoji'* *'emo'*
'emoji' 'emo' boolean (default: on)
global
{not in Vi}
{only available when compiled with the |+multi_byte|
feature}
Sets the character encoding used inside Vim. It applies to text in
the buffers, registers, Strings in expressions, text stored in the
shada file, etc. It sets the kind of characters which Vim can work
with. See |encoding-names| for the possible values.
When on all Unicode emoji characters are considered to be full width.
'encoding' cannot be changed after startup, because (1) it causes
non-ASCII text inside Vim to become invalid, and (2) it complicates
runtime logic. The recommended 'encoding' is "utf-8". Remote plugins
and GUIs only support utf-8. See |multibyte|.
The character encoding of files can be different from 'encoding'.
*'encoding'* *'enc'* *E543*
'encoding' 'enc' Removed. |vim-differences| {Nvim}
Nvim always uses UTF-8 internally. RPC communication
(remote plugins/GUIs) must use UTF-8 strings.
The character encoding of files can be different than UTF-8.
This is specified with 'fileencoding'. The conversion is done with
iconv() or as specified with 'charconvert'.
If you need to know whether 'encoding' is a multi-byte encoding, you
can use: >
if has("multi_byte_encoding")
<
When you set this option, it fires the |EncodingChanged| autocommand
event so that you can set up fonts if necessary.
When the option is set, the value is converted to lowercase. Thus
you can set it with uppercase values too. Underscores are translated
to '-' signs.
When the encoding is recognized, it is changed to the standard name.
For example "Latin-1" becomes "latin1", "ISO_88592" becomes
"iso-8859-2" and "utf8" becomes "utf-8".
When "unicode", "ucs-2" or "ucs-4" is used, Vim internally uses utf-8.
You don't notice this while editing, but it does matter for the
|shada-file|. And Vim expects the terminal to use utf-8 too. Thus
setting 'encoding' to one of these values instead of utf-8 only has
effect for encoding used for files when 'fileencoding' is empty.
*'endofline'* *'eol'* *'noendofline'* *'noeol'*
'endofline' 'eol' boolean (default on)
local to buffer
@@ -2297,20 +2258,14 @@ A jump table for the options with a short description can be found at |Q_op|.
feature}
Sets the character encoding for the file of this buffer.
When 'fileencoding' is different from 'encoding', conversion will be
When 'fileencoding' is different from "utf-8", conversion will be
done when writing the file. For reading see below.
When 'fileencoding' is empty, the same value as 'encoding' will be
used (no conversion when reading or writing a file).
Conversion will also be done when 'encoding' and 'fileencoding' are
both a Unicode encoding and 'fileencoding' is not utf-8. That's
because internally Unicode is always stored as utf-8.
WARNING: Conversion can cause loss of information! When
'encoding' is "utf-8" or another Unicode encoding, conversion
is most likely done in a way that the reverse conversion
results in the same text. When 'encoding' is not "utf-8" some
characters may be lost!
When 'fileencoding' is empty, the file will be saved with utf-8
encoding. (no conversion when reading or writing a file).
WARNING: Conversion to a non-Unicode encoding can cause loss of
information!
See 'encoding' for the possible values. Additionally, values may be
See |encoding-names| for the possible values. Additionally, values may be
specified that can be handled by the converter, see
|mbyte-conversion|.
@@ -2323,8 +2278,8 @@ A jump table for the options with a short description can be found at |Q_op|.
Prepending "8bit-" and "2byte-" has no meaning here, they are ignored.
When the option is set, the value is converted to lowercase. Thus
you can set it with uppercase values too. '_' characters are
replaced with '-'. If a name is recognized from the list for
'encoding', it is replaced by the standard name. For example
replaced with '-'. If a name is recognized from the list at
|encoding-names|, it is replaced by the standard name. For example
"ISO8859-2" becomes "iso-8859-2".
When this option is set, after starting to edit a file, the 'modified'
@@ -2337,11 +2292,6 @@ A jump table for the options with a short description can be found at |Q_op|.
This option can not be changed when 'modifiable' is off.
*'fe'*
NOTE: Before version 6.0 this option specified the encoding for the
whole of Vim, this was a mistake. Now use 'encoding' instead. The
old short name was 'fe', which is no longer used.
*'fileencodings'* *'fencs'*
'fileencodings' 'fencs' string (default: "ucs-bom,utf-8,default,latin1")
global
@@ -2352,12 +2302,8 @@ A jump table for the options with a short description can be found at |Q_op|.
mentioned character encoding. If an error is detected, the next one
in the list is tried. When an encoding is found that works,
'fileencoding' is set to it. If all fail, 'fileencoding' is set to
an empty string, which means the value of 'encoding' is used.
WARNING: Conversion can cause loss of information! When
'encoding' is "utf-8" (or one of the other Unicode variants)
conversion is most likely done in a way that the reverse
conversion results in the same text. When 'encoding' is not
"utf-8" some non-ASCII characters may be lost! You can use
an empty string, which means that UTF-8 is used.
WARNING: Conversion can cause loss of information! You can use
the |++bad| argument to specify what is done with characters
that can't be converted.
For an empty file or a file with only ASCII characters most encodings
@@ -2383,11 +2329,11 @@ A jump table for the options with a short description can be found at |Q_op|.
because Vim cannot detect an error, thus the encoding is always
accepted.
The special value "default" can be used for the encoding from the
environment. It is useful when 'encoding' is set to "utf-8" and
your environment uses a non-latin1 encoding, such as Russian.
When 'encoding' is "utf-8" and a file contains an illegal byte
sequence it won't be recognized as UTF-8. You can use the |8g8|
command to find the illegal byte sequence.
environment. It is useful when your environment uses a non-latin1
encoding, such as Russian.
When a file contains an illegal UTF-8 byte sequence it won't be
recognized as "utf-8". You can use the |8g8| command to find the
illegal byte sequence.
WRONG VALUES: WHAT'S WRONG:
latin1,utf-8 "latin1" will always be used
utf-8,ucs-bom,latin1 BOM won't be recognized in an utf-8
@@ -3046,8 +2992,7 @@ A jump table for the options with a short description can be found at |Q_op|.
Note: The size of these fonts must be exactly twice as wide as the one
specified with 'guifont' and the same height.
'guifontwide' is only used when 'encoding' is set to "utf-8" and
'guifontset' is empty or invalid.
'guifontwide' is only used when 'guifontset' is empty or invalid.
When 'guifont' is set and a valid font is found in it and
'guifontwide' is empty Vim will attempt to find a matching
double-width font and set 'guifontwide' to it.
@@ -3096,7 +3041,7 @@ A jump table for the options with a short description can be found at |Q_op|.
The same applies to the modeless selection.
*'go-P'*
'P' Like autoselect but using the "+ register instead of the "*
register.
register.
*'go-A'*
'A' Autoselect for the modeless selection. Like 'a', but only
applies to the modeless selection.
@@ -3164,9 +3109,6 @@ A jump table for the options with a short description can be found at |Q_op|.
removing it after the GUI has started has no effect.
*'guipty'* *'noguipty'*
'guipty' Removed. |vim-differences| {Nvim}
*'guitablabel'* *'gtl'*
'guitablabel' 'gtl' string (default empty)
global
@@ -3411,12 +3353,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Can be overruled by using "\c" or "\C" in the pattern, see
|/ignorecase|.
*'imactivatefunc'* *'imaf'*
'imactivatefunc' 'imaf' Removed. |vim-differences| {Nvim}
*'imactivatekey'* *'imak'*
'imactivatekey' 'imak' Removed. |vim-differences| {Nvim}
*'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'*
'imcmdline' 'imc' boolean (default off)
global
@@ -3473,8 +3409,17 @@ A jump table for the options with a short description can be found at |Q_op|.
The value is set to 1 when it is not -1 and setting the 'keymap'
option to a valid keymap name.
*'imstatusfunc'* *'imsf'*
'imstatusfunc' 'imsf' Removed. |vim-differences| {Nvim}
*'inccommand'* *'icm'*
'inccommand' 'icm' string (default "")
global
"nosplit": Shows the effects of a command incrementally, as you type.
"split" : Also shows partial off-screen results in a preview window.
Works for |:substitute|, |:smagic|, |:snomagic|. |hl-Substitute|
If the preview is too slow (exceeds 'redrawtime') then 'inccommand' is
automatically disabled until |Command-line-mode| is done.
*'include'* *'inc'*
'include' 'inc' string (default "^\s*#\s*include")
@@ -3712,7 +3657,7 @@ A jump table for the options with a short description can be found at |Q_op|.
128 - 159 "~@" - "~_"
160 - 254 "| " - "|~"
255 "~?"
When 'encoding' is a Unicode one, illegal bytes from 128 to 255 are
Illegal bytes from 128 to 255 (invalid UTF-8) are
displayed as <xx>, with the hexadecimal value of the byte.
When 'display' contains "uhex" all unprintable characters are
displayed as <xx>.
@@ -3732,9 +3677,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Insert two spaces after a '.', '?' and '!' with a join command.
Otherwise only one space is inserted.
*'key'*
'key' Removed. |vim-differences| {Nvim}
*'keymap'* *'kmp'* *E544*
'keymap' 'kmp' string (default "")
local to buffer
@@ -3959,6 +3901,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global
Strings to use in 'list' mode and for the |:list| command. It is a
comma separated list of string settings.
*lcs-eol*
eol:c Character to show at the end of each line. When
omitted, there is no extra character at the end of the
@@ -3993,8 +3936,7 @@ A jump table for the options with a short description can be found at |Q_op|.
omitted.
The characters ':' and ',' should not be used. UTF-8 characters can
be used when 'encoding' is "utf-8", otherwise only printable
characters are allowed. All characters must be single width.
be used. All characters must be single width.
Examples: >
:set lcs=tab:>-,trail:-
@@ -4013,9 +3955,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Note that using the "-u NONE" and "--noplugin" command line arguments
reset this option. |-u| |--noplugin|
*'macatsui'* *'nomacatsui'*
'macatsui' Removed. |vim-differences| {Nvim}
*'magic'* *'nomagic'*
'magic' boolean (default on)
global
@@ -4094,7 +4033,6 @@ A jump table for the options with a short description can be found at |Q_op|.
{only available when compiled with the |+multi_byte|
feature}
The maximum number of combining characters supported for displaying.
Only used when 'encoding' is "utf-8".
The default is OK for most languages. Hebrew may require 4.
Maximum value is 6.
Even when this option is set to 2 you can still edit text with more
@@ -4410,7 +4348,7 @@ A jump table for the options with a short description can be found at |Q_op|.
respectively; see |CTRL-A| for more info on these commands.
alpha If included, single alphabetical characters will be
incremented or decremented. This is useful for a list with a
letter index a), b), etc. *octal-nrformats*
letter index a), b), etc. *octal-nrformats*
octal If included, numbers that start with a zero will be considered
to be octal. Example: Using CTRL-A on "007" results in "010".
hex If included, numbers starting with "0x" or "0X" will be
@@ -4440,7 +4378,7 @@ A jump table for the options with a short description can be found at |Q_op|.
relative to the cursor. Together with 'number' there are these
four combinations (cursor in line 3):
'nonu' 'nu' 'nonu' 'nu'
'nonu' 'nu' 'nonu' 'nu'
'nornu' 'nornu' 'rnu' 'rnu'
|apple | 1 apple | 2 apple | 2 apple
@@ -4798,8 +4736,8 @@ A jump table for the options with a short description can be found at |Q_op|.
global
{only available when compiled with the |+reltime|
feature}
The time in milliseconds for redrawing the display. This applies to
searching for patterns for 'hlsearch' and |:match| highlighting.
Time in milliseconds for redrawing the display. Applies to
'hlsearch', 'inccommand' and |:match| highlighting.
When redrawing takes more than this many milliseconds no further
matches will be highlighted. This is used to avoid that Vim hangs
when using a very complicated pattern.
@@ -4859,9 +4797,6 @@ A jump table for the options with a short description can be found at |Q_op|.
For the ":substitute" command the number of substitutions is used
instead of the number of lines.
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'restorescreen' 'rs' Removed. |vim-differences| {Nvim}
*'revins'* *'ri'* *'norevins'* *'nori'*
'revins' 'ri' boolean (default off)
global
@@ -4969,6 +4904,7 @@ A jump table for the options with a short description can be found at |Q_op|.
keymap/ key mapping files |mbyte-keymap|
lang/ menu translations |:menutrans|
menu.vim GUI menus |menu.vim|
pack/ packages |:packadd|
plugin/ plugin scripts |write-plugin|
print/ files for printing |postscript-print-encoding|
spell/ spell checking files |spell|
@@ -4995,6 +4931,8 @@ A jump table for the options with a short description can be found at |Q_op|.
ordering. This is for preferences to overrule or add to the
distributed defaults or system-wide settings (rarely needed).
More entries are added when using |packages|.
Note that, unlike 'path', no wildcards like "**" are allowed. Normal
wildcards are allowed, but can significantly slow down searching for
runtime files. For speed, use as few items as possible and avoid
@@ -5471,6 +5409,8 @@ A jump table for the options with a short description can be found at |Q_op|.
The |FilterReadPre|, |FilterReadPost| and |FilterWritePre|,
|FilterWritePost| autocommands event are not triggered when
'shelltemp' is off.
The `system()` function does not respect this option and always uses
temp files.
*'shellxescape'* *'sxe'*
'shellxescape' 'sxe' string (default: "";
@@ -5569,9 +5509,6 @@ A jump table for the options with a short description can be found at |Q_op|.
shm=a Abbreviation, but no loss of information.
shm=at Abbreviation, and truncate message when necessary.
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
'shortname' 'sn' Removed. |vim-differences| {Nvim}
*'showbreak'* *'sbr'* *E595*
'showbreak' 'sbr' string (default "")
global
@@ -5842,9 +5779,6 @@ A jump table for the options with a short description can be found at |Q_op|.
(_xx is an underscore, two letters and followed by a non-letter).
This is mainly for testing purposes. You must make sure the correct
encoding is used, Vim doesn't check it.
When 'encoding' is set the word lists are reloaded. Thus it's a good
idea to set 'spelllang' after setting 'encoding' to avoid loading the
files twice.
How the related spell files are found is explained here: |spell-load|.
If the |spellfile.vim| plugin is active and you use a language name
@@ -6185,9 +6119,6 @@ A jump table for the options with a short description can be found at |Q_op|.
This option is used together with 'bufhidden' and 'buftype' to
specify special kinds of buffers. See |special-buffers|.
*'swapsync'* *'sws'*
'swapsync' 'sws' Removed. |vim-differences| {Nvim}
*'switchbuf'* *'swb'*
'switchbuf' 'swb' string (default "")
global
@@ -6411,9 +6342,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Resetting this option is useful when using a ":tag" command in a
mapping which should not change the tagstack.
*'term'* *E529* *E530* *E531*
'term' Removed. |vim-differences| {Nvim}
*'termbidi'* *'tbidi'*
*'notermbidi'* *'notbidi'*
'termbidi' 'tbidi' boolean (default off)
@@ -6427,9 +6355,6 @@ A jump table for the options with a short description can be found at |Q_op|.
'arabicshape' is ignored, but 'rightleft' isn't changed automatically.
For further details see |arabic.txt|.
*'termencoding'* *'tenc'*
'termencoding' 'tenc' Removed. |vim-differences| {Nvim}
*'termguicolors'* *'tgc'*
'termguicolors' 'tgc' boolean (default off)
global
@@ -6584,28 +6509,10 @@ A jump table for the options with a short description can be found at |Q_op|.
to be garbled (e.g., when it contains a CR or NL character).
{not available when compiled without the |+statusline| feature}
*'toolbar'* *'tb'*
'toolbar' 'tb' Removed. |vim-differences| {Nvim}
*'toolbariconsize'* *'tbis'*
'toolbariconsize' 'tbis' Removed. |vim-differences| {Nvim}
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
'ttybuiltin' 'tbi' Removed. |vim-differences| {Nvim}
*'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
'ttyfast' 'tf' Removed. |vim-differences| {Nvim}
*'ttymouse'* *'ttym'*
'ttymouse' 'ttym' Removed. |vim-differences| {Nvim}
*'ttyscroll'* *'tsl'*
'ttyscroll' 'tsl' Removed. |vim-differences| {Nvim}
*'ttytype'* *'tty'*
'ttytype' 'tty' Alias for 'term'. Removed. |vim-differences| {Nvim}
*'undodir'* *'udir'* *E926*
*'undodir'* *'udir'* *E5003*
'undodir' 'udir' string (default "$XDG_DATA_HOME/nvim/undo")
global
{only when compiled with the |+persistent_undo| feature}
@@ -6759,12 +6666,6 @@ A jump table for the options with a short description can be found at |Q_op|.
with Unix. The Unix version of Vim cannot source dos format scripts,
but the Windows version of Vim can source unix format scripts.
*'viminfo'* *'vi'*
'viminfo' 'vi' string
global
Deprecated alias for 'shada' option. Is kept for compatibility
reasons.
*'virtualedit'* *'ve'*
'virtualedit' 've' string (default "")
global
@@ -6810,9 +6711,6 @@ A jump table for the options with a short description can be found at |Q_op|.
Give a warning message when a shell command is used while the buffer
has been changed.
*'weirdinvert'* *'wiv'* *'noweirdinvert'* *'nowiv'*
'weirdinvert' 'wiv' Removed. |vim-differences| {Nvim}
*'whichwrap'* *'ww'*
'whichwrap' 'ww' string (Vim default: "b,s", Vi default: "")
global

View File

@@ -1,4 +1,4 @@
*pattern.txt* For Vim version 7.4. Last change: 2016 Apr 03
*pattern.txt* For Vim version 7.4. Last change: 2016 Apr 26
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1071,8 +1071,8 @@ x A single character, with no special meaning, matches itself
belonging to that character class. The following character classes
are supported:
Name Contents ~
*[:alnum:]* [:alnum:] letters and digits
*[:alpha:]* [:alpha:] letters
*[:alnum:]* [:alnum:] ASCII letters and digits
*[:alpha:]* [:alpha:] ASCII letters
*[:blank:]* [:blank:] space and tab characters
*[:cntrl:]* [:cntrl:] control characters
*[:digit:]* [:digit:] decimal digits
@@ -1080,7 +1080,7 @@ x A single character, with no special meaning, matches itself
*[:lower:]* [:lower:] lowercase letters (all letters when
'ignorecase' is used)
*[:print:]* [:print:] printable characters including space
*[:punct:]* [:punct:] punctuation characters
*[:punct:]* [:punct:] ASCII punctuation characters
*[:space:]* [:space:] whitespace characters
*[:upper:]* [:upper:] uppercase letters (all letters when
'ignorecase' is used)
@@ -1097,7 +1097,8 @@ x A single character, with no special meaning, matches itself
These items only work for 8-bit characters, except [:lower:] and
[:upper:] also work for multi-byte characters when using the new
regexp engine. See |two-engines|. In the future these items may
work for multi-byte characters.
work for multi-byte characters. For now, to get all "alpha"
characters you can use: [[:lower:][:upper:]].
*/[[=* *[==]*
- An equivalence class. This means that characters are matched that
have almost the same meaning, e.g., when ignoring accents. This

View File

@@ -12,16 +12,16 @@ Nvim delegates some features to dynamic "providers".
Python integration *provider-python*
Nvim supports the Vim legacy |python-vim| and |python3| interfaces via
external Python interpreters connected via |RPC|,
external Python interpreters connected via |RPC|.
Note: Only the Vim 7.3 API is supported; bindeval (Vim 7.4) is not.
PYTHON QUICKSTART ~
If you used a package manager to install Nvim there's a good chance that
it also provides the `neovim` Python package. If it doesn't, follow these
steps to install the package with Python's package manager, `pip`.
If you used a package manager to install Nvim, you might already have the
required `neovim` Python package. Run |:CheckHealth| to see if your system is
up-to-date.
Following are steps to install the package with Python's `pip` tool.
Note: Depending on your system, `pip` might refer to Python 2 or Python 3,
which is why the following instructions mention `pip2` or `pip3`
@@ -74,24 +74,19 @@ Note: This requires you to install the python3-neovim module properly. >
let g:python3_host_skip_check = 1
TROUBLESHOOTING *python-trouble*
If you have trouble with a plugin that uses the `neovim` Python client, use
the |:CheckHealth| command to diagnose your setup.
==============================================================================
Ruby integration *provider-ruby*
Nvim supports the Vim legacy |ruby-vim| interface via external Ruby
interpreters connected via |RPC|.
Run |:CheckHealth| to see if your system is up-to-date.
RUBY QUICKSTART ~
To use Vim Ruby plugins with Nvim, just install the latest `neovim` RubyGem: >
$ gem install neovim
RUBY PROVIDER CONFIGURATION ~
*g:loaded_ruby_provider*
To disable Ruby support: >

View File

@@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.4. Last change: 2016 Mar 19
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -53,6 +53,10 @@ command with 'l'.
If the current window was closed by an |autocommand| while processing a
location list command, it will be aborted.
*E925* *E926*
If the current quickfix or location list was changed by an |autocommand| while
processing a quickfix or location list command, it will be aborted.
*:cc*
:cc[!] [nr] Display error [nr]. If [nr] is omitted, the same
error is displayed again. Without [!] this doesn't
@@ -259,9 +263,23 @@ location list command, it will be aborted.
The 'switchbuf' settings are respected when jumping
to a buffer.
:cl[ist] +{count} List the current and next {count} valid errors. This
is similar to ":clist from from+count", where "from"
is the current error position.
:cl[ist]! [from] [, [to]]
List all errors.
:cl[ist]! +{count} List the current and next {count} error lines. This
is useful to see unrecognized lines after the current
one. For example, if ":clist" shows:
8384 testje.java:252: error: cannot find symbol ~
Then using ":cl! +3" shows the reason:
8384 testje.java:252: error: cannot find symbol ~
8385: ZexitCode = Fmainx(); ~
8386: ^ ~
8387: symbol: method Fmainx() ~
*:lli* *:llist*
:lli[st] [from] [, [to]]
Same as ":clist", except the location list for the
@@ -306,7 +324,7 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
etc.
< When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected excecution stops.
When an error is detected execution stops.
The last buffer (or where an error occurred) becomes
the current buffer.
{cmd} can contain '|' to concatenate several commands.
@@ -1493,12 +1511,6 @@ However, to properly parse such a complex file, an external filter should
be used. See the description further above how to make such a filter known
by Vim.
*errorformat-Perl*
In $VIMRUNTIME/tools you can find the efm_perl.pl script, which filters Perl
error messages into a format that quickfix mode will understand. See the
start of the file about how to use it. (This script is deprecated, see
|compiler-perl|.)
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -1,275 +0,0 @@
*quotes.txt* For Vim version 7.4. Last change: 2010 Nov 03
VIM REFERENCE MANUAL by Bram Moolenaar
*quotes*
Here are some nice quotes about Vim that I collected from news and mail.
vim (vim) noun - Ebullient vitality and energy. [Latin, accusative of vis,
strength] (Dictionary)
Vim is so much better than vi that a great many of my old vi :map's became
immediately obsolete! (Tony Nugent, Australia)
Coming with a very GUI mindset from Windows, I always thought of people using
Vi as some kind of outer space alien in human clothes. Once I tried I really
got addicted by its power and now I found myself typing Vim keypresses in the
oddest places! That's why I would like to see Vim embedded in every
application which deals with text editing. (Jos<6F> Fonseca)
I was a 12-year emacs user who switched to Vim about a year ago after finally
giving up on the multiple incompatible versions, flaky contributed packages,
disorganized keystrokes, etc. And it was one of the best moves I ever made.
(Joel Burton)
Although all of the programs were used during the preparation of the new and
revised material, most of the editing was done with Vim versions 4.5 and 5.0
under GNU-Linux (Redhat 4.2). (Arnold Robbins, Israel, author of "Learning
the Vi editor")
Out of all the open software i've ever seen and used, and i've seen a lot, Vim
is the best, most useful and highest quality to work with, second only to the
linux kernel itself. (Peter Jay Salzman)
It's well worth noting that the _entirety_ of SourceForge was written using
Vim and its nifty PHP syntax highlighting. I think the entire SF.net tech
staff uses Vim and we're all excited to have you aboard! (Tim Perdue)
Vim is one of a select bunch of tools for which I have no substitute. It is
a brilliant piece of work! (Biju Chacko)
A previous girlfriend of mine switched to emacs. Needless to say, the
relationship went nowhere. (Geoffrey Mann)
I rarely think about Vim, in the same way that I guess a fish rarely thinks
about water. It's the environment in which everything else happens. I'm a
fairly busy system administrator working on a lot of different platforms. Vim
is the only thing that's consistent across all my systems, and it's just about
the only thing that doesn't break from time to time. When a new system comes
in the door without Vim, I install it right away. Great to have a tool that's
the same everywhere, that's completely reliable, so I can ignore it and think
about other things. (Pete Schaeffer)
Having recently succeeded in running Vim via telnet through a Nokia
Communicator, I can now report that it works nicely on a Palm Pilot too.
(Allan Kelly, Scotland)
You've done a tremendous job with 'VIM', Bram! The more I use it, the more
impressed I get (I am an old 'vi' die hard who once started out with early
versions of 'emacs' in the late 1970's and was relieved by finding 'vi' in the
first UNIX I came across in 1983). In my opinion, it's about time 'VIM'
replace 'emacs' as the standard for top editors. (Bo Thide', Sweden)
I love and use VIM heavily too. (Larry Wall)
Vi is like a Ferrari, if you're a beginner, it handles like a bitch, but once
you get the hang of it, it's small, powerful and FAST! (Unknown)
VIM is like a new model Ferrari, and sounds like one too - "VIIIIIIMMM!"
(Stephen Riehm, Germany)
Schon bei Nutzung eines Bruchteils der VIM-Funktionen wird der Benutzer recht
schnell die Vorzuege dieses Editors kennen- und schaetzenlernen.
Translated: Even when only using a fraction of VIM-functions, the user will
quickly get used to and appreciate the advantages of this editor. (Garry
Glendown, conclusion of an article on VIM in iX magazine 9/1998)
I've recently acquired the O'Reilly book on VI (it also discusses VIM
in-depth), and I'm amazed at just how powerful this application is. (Jeffrey
Rankin)
This guide was written using the Windows 9.x distribution of GVIM, which is
quite possibly the greatest thing to come along since God created the naked
girl. (Michael DiBernardo)
Boy, I thought I knew almost everything about VIM, but every time I browse the
online documentation, I hit upon a minor but cool aspect of a VIM feature that
I didn't know before! I must say the documentation is one the finest I've
ever seen in a product -- even better than most commercial products.
(Gautam Mudunuri)
VIM 4.5 is really a fantastic editor. It has sooooo many features and more
importantly, the defaults are so well thought out that you really don't have
to change anything!! Words cannot express my amazement and gratitude to the
creators of VIM. Keep it up. (Vikas, USA)
I wonder how long it will be before people will refer to other Vi editors as
VIM clones? (Darren Hiebert)
I read about [auto-positioning-in-file-based-on-the-errors-from-make] in one
of those "Perfect Programmer's Editor" threads and was delighted to discover
that VIM already supports it. (Brendan Macmillan, Australia)
I just discovered VIM (5.0) and I'm telling everyone I know about it!
I tell them VIM stands for VI for the new (M)illenium. Thanks so much!
(Matt F. Valentine)
I think from now on "vi" should be called "Vim Imitation", not the other way
around. (Rungun Ramanathan)
The Law of VIM:
For each member b of the possible behaviour space B of program P, there exists
a finite time t before which at least one user u in the total user space U of
program P will request b becomes a member of the allowed behaviour space B'
(B' <= B).
In other words: Sooner or later everyone wants everything as an option.
(Negri)
Whenever I move to a new computing platform, the first thing I do is to port
VIM. Lately, I am simply stunned by its ease of compilation using the
configure facility. (A.M. Sabuncu, Turkey)
The options are really excellent and very powerful. (Anish Maharaj)
The Spring user-interface designs are in, and word from the boutiques is that
80x24 text-only mode is back with a *vengeance! Vi editor clone VIM burst onto
March desk-tops with a dazzling show of pastel syntax highlights for its 5.0
look. Strident and customizable, VIM raises eyebrows with its interpretation
of the classic Vi single-key macro collection.
http://www.ntk.net/index.cgi?back=archive98/now0327.txt&line=179#l
I just wanted to take this opportunity to let you know that VIM 5 ROCKS!
Syntax highlighting: how did I survive without it?! Thank you for creating
mankind's best editor! (Mun Johl, USA)
Thanks again for VIM. I use it every day on Linux. (Eric Foster-Johnson,
author of the book "UNIX Programming Tools")
The BEST EDITOR EVER (Stuart Woolford)
I have used most of VIM's fancy features at least once, many frequently, and I
can honestly say that I couldn't live with anything less anymore. My
productivity has easily doubled compared to what it was when I used vi.
(Sitaram Chamarty)
I luv VIM. It is incredible. I'm naming my first-born Vimberly. (Jose
Unpingco, USA)
Hint: "VIM" is "vi improved" - much better! (Sven Guckes, Germany)
I use VIM every day. I spend more time in VIM than in any other program...
It's the best vi clone there is. I think it's great. (Craig Sanders,
Australia)
I strongly advise using VIM--its infinite undo/redo saved me much grief.
(Terry Brown)
Thanks very much for writing what in my opinion is the finest text editor on
the planet. If I were to get another cat, I would name it "Vim".
(Bob Sheehan, USA)
I typed :set all and the screen FILLED up with options. A whole screen of
things to be set and unset. I saw some of my old friends like wrapmargin,
modelines and showmode, but the screen was FILLED with new friends! I love
them all! I love VIM! I'm so happy that I've found this editor! I feel
like how I once felt when I started using vi after a couple of years of using
ed. I never thought I'd forsake my beloved ed, but vi ... oh god, vi was
great. And now, VIM. (Peter Jay Salzman, USA)
I am really happy with such a wonderful software package. Much better than
almost any expensive, off the shelf program. (Jeff Walker)
Whenever I reread the VIM documentation I'm overcome with excitement at the
power of the editor. (William Edward Webber, Australia)
Hurrah for VIM!! It is "at your fingertips" like vi, and has the extensions
that vi sorely needs: highlighting for executing commands on blocks, an easily
navigable and digestible help screen, and more. (Paul Pax)
The reason WHY I don't have this amazingly useful macro anymore, is that I
now use VIM - and this is built in!! (Stephen Riehm, Germany)
I am a user of VIM and I love it. I use it to do all my programming, C,
C++, HTML what ever. (Tim Allwine)
I discovered VIM after years of struggling with the original vi, and I just
can't live without it anymore. (Emmanuel Mogenet, USA)
Emacs has not a bit of chance to survive so long as VIM is around. Besides,
it also has the most detailed software documentation I have ever seen---much
better than most commercial software! (Leiming Qian)
This version of VIM will just blow people apart when they discover just how
fantastic it is! (Tony Nugent, Australia)
I took your advice & finally got VIM & I'm really impressed. Instant convert.
(Patrick Killelea, USA)
VIM is by far my favorite piece of shareware and I have been particularly
pleased with version 3.0. This is really a solid piece of work. (Robert
Colon, USA)
VIM is a joy to use, it is so well thought and practical that I wonder why
anybody would use visual development tools. VIM is powerful and elegant, it
looks deceptively simple but is almost as complex as a 747 (especially when I
look at my growing vimrc), keep up that wonderful job, VIM is a centerpiece
of the free software world. (Louis-David Mitterand, USA)
I cannot believe how great it is to use VIM. I think the guys at work are
getting tired of hearing me bragging about it. Others eyes are lighting up.
(Rick Croote)
Emacs takes way too much time to start up and run, it is too big and bulky for
effective use and the interface is more confusing than it is of any help. VIM
however is short, it is fast, it is powerful, it has a good interface and it
is all purpose. (Paal Ditlefsen Ekran)
From the first time I got VIM3.0, I was very enthusiastic. It has almost no
problems. The swapfile handling and the backup possibilities are robust, also
the protection against editing one file twice. It is very compatible to the
real VI (and that is a MUST, because my brain is trained over years in using
it). (Gert van Antwerpen, Holland)
Visual mode in VIM is a very powerful thing! (Tony Nugent, Australia)
I have to say that VIM is =THE= single greatest piece of source code to ever
come across the net (Jim Battle, USA).
In fact, if you do want to get a new vi I'd suggest VIM-3.0. This is, by
far, the best version of vi I've ever seen (Albert W. Schueller).
I should mention that VIM is a very good editor and can compete with anything
(Ilya Beloozerov).
To tell the truth sometimes I used elvis, vile, xvi, calvin, etc. And this is
the reason that I can state that VIM is the best! (Ferenc Deak, Hungary)
VIM is by far the best editor that I have used in a long time, and I have
looked at just about every thing that is available for every platform that I
use. VIM is the best on all of them. (Guy L. Oliver)
VIM is the greatest editor since the stone chisel. (Jose Unpingco, USA)
I would like to say that with VIM I am finally making the 'emacs to vi'
transition - as an Editor it is so much better in many ways: keyboard layout,
memory usage, text alteration to name 3. (Mark Adam)
In fact, now if I want to know what a particular setting does in vi, I fire up
VIM and check out its help! (Nikhil Patel, USA)
As a vi user, VIM has made working with text a far more pleasant task than
before I encountered this program. (Steinar Knutsen, Norway)
I use VIM since version 3.0. Since that time, it is the ONLY editor I use,
with Solaris, Linux and OS/2 Warp. I suggest all my friends to use VIM, they
try, and they continue using it. VIM is really the best software I have ever
downloaded from the Internet, and the best editor I know of. (Marco
Eccettuato, Italy)
In summary:
__ ___ _ _ _ ___ _____ `
\ \ / (_)_ __ ___ (_)___ | | | |/ _ \_ _| `
\ \ / /| | '_ ` _ \ | / __| | |_| | | | || | `
\ V / | | | | | | | | \__ \ | _ | |_| || | `
\_/ |_|_| |_| |_| |_|___/ |_| |_|\___/ |_| `
____ _____ _ _ _____ _____ _ _ `
/ ___|_ _| | | | ___| ___| | | `
\___ \ | | | | | | |_ | |_ | | | `
___) || | | |_| | _| | _| |_|_| `
|____/ |_| \___/|_| |_| (_|_) (Tony Nugent, Australia) `
vim:tw=78:ts=8:ft=help:norl:

View File

@@ -223,6 +223,8 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
pack/*/opt/{name} ~
The directory is added to 'runtimepath' if it wasn't
there yet.
If the directory pack/*/opt/{name}/after exists it is
added at the end of 'runtimepath'.
Note that {name} is the directory name, not the name
of the .vim file. All the files matching the pattern
@@ -492,6 +494,9 @@ To load packages earlier, so that 'runtimepath' gets updated: >
This also works when loading plugins is disabled. The automatic loading will
only happen once.
If the package has an "after" directory, that directory is added to the end of
'runtimepath', so that anything there will be loaded later.
Using a single plugin and loading it automatically ~

View File

@@ -198,7 +198,8 @@ argument.
-Z Restricted mode. All commands that make use of an external
shell are disabled. This includes suspending with CTRL-Z,
":sh", filtering, the system() function, backtick expansion,
delete(), rename(), mkdir(), writefile(), libcall(), etc.
delete(), rename(), mkdir(), writefile(), libcall(),
jobstart(), etc.
*-e*
-e Start Vim in Ex mode |Q|.
@@ -1178,9 +1179,6 @@ running) you have additional options:
already set (registers, marks, |v:oldfiles|, etc.)
will be overwritten.
*:rv* *:rviminfo*
:rv[iminfo][!] [file] Deprecated alias to |:rshada| command.
*:wsh* *:wshada* *E137*
:wsh[ada][!] [file] Write to ShaDa file [file] (default: see above).
The information in the file is first read in to make
@@ -1196,9 +1194,6 @@ running) you have additional options:
Note: Executing :wshada will reset all |'quote| marks.
*:wv* *:wviminfo*
:wv[iminfo][!] [file] Deprecated alias to |:wshada| command.
*:o* *:ol* *:oldfiles*
:o[ldfiles] List the files that have marks stored in the ShaDa
file. This list is read on startup and only changes

View File

@@ -4852,6 +4852,9 @@ SignColumn column where |signs| are displayed
*hl-IncSearch*
IncSearch 'incsearch' highlighting; also used for the text replaced with
":s///c"
*hl-Substitute*
Substitute |:substitute| replacement text highlighting
*hl-LineNr*
LineNr Line number for ":number" and ":#" commands, and when 'number'
or 'relativenumber' option is set.
@@ -4883,6 +4886,10 @@ PmenuSbar Popup menu: scrollbar.
PmenuThumb Popup menu: Thumb of the scrollbar.
*hl-Question*
Question |hit-enter| prompt and yes/no questions
*hl-QuickFixLine*
QuickFixLine The selected |quickfix| item in the quickfix window.
|hl-CursorLine| is combined with this when the cursor is on
the currently selected quickfix item.
*hl-Search*
Search Last search pattern highlighting (see 'hlsearch').
Also used for highlighting the current line in the quickfix
@@ -4922,8 +4929,6 @@ TabLineSel tab pages line, active tab page label
Title titles for output from ":set all", ":autocmd" etc.
*hl-Visual*
Visual Visual mode selection
*hl-VisualNOS*
VisualNOS Removed. |vim-differences| {Nvim}
*hl-WarningMsg*
WarningMsg warning messages
*hl-WildMenu*

View File

@@ -83,14 +83,21 @@ In the GUI tab pages line you can use the right mouse button to open menu.
Execute {cmd} and when it opens a new window open a new tab
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|:execute| and |:normal|.
When [count] is omitted the tab page appears after the current
one.
When [count] is specified the new tab page comes after tab
page [count]. Use ":0tab cmd" to get the new tab page as the
first one.
If [count] is given the new tab page appears after the tab
page [count] otherwise the new tab page will appear after the
current one.
Examples: >
:tab split " opens current buffer in new tab page
:tab help gt " opens tab page with help for "gt"
:tab split " opens current buffer in new tab page
:tab help gt " opens tab page with help for "gt"
:.tab help gt " as above
:+tab help " opens tab page with help after the next
" tab page
:-tab help " opens tab page with help before the
" current one
:0tab help " opens tab page with help before the
" first one
:$tab help " opens tab page with help after the last
" one
CTRL-W gf Open a new tab page and edit the file name under the cursor.
See |CTRL-W_gf|.
@@ -140,7 +147,7 @@ something else.
:{count}tabo[nly][!]
Close all tab pages except the {count}th one. >
:.tabonly " one
:.tabonly " as above
:-tabonly " close all tab pages except the previous one
:+tabonly " close all tab pages except the next one
:1tabonly " close all tab pages except the first one

View File

@@ -36,9 +36,10 @@ these differences.
- 'autoindent' is set by default
- 'autoread' is set by default
- 'backspace' defaults to "indent,eol,start"
- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|)
- 'complete' doesn't include "i"
- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
- 'display' defaults to "lastline"
- 'encoding' defaults to "utf-8"
- 'formatoptions' defaults to "tcqj"
- 'history' defaults to 10000 (the maximum)
- 'hlsearch' is set by default
@@ -54,6 +55,7 @@ these differences.
- 'tabpagemax' defaults to 50
- 'tags' defaults to "./tags;,tags"
- 'ttyfast' is always set
- 'undodir' defaults to ~/.local/share/nvim/undo (|xdg|), auto-created
- 'viminfo' includes "!"
- 'wildmenu' is set by default
@@ -61,7 +63,7 @@ these differences.
3. New Features *nvim-features*
MAJOR FEATURES ~
MAJOR COMPONENTS ~
Embedded terminal emulator |terminal-emulator|
RPC API |RPC|
@@ -73,44 +75,65 @@ Python plugins |provider-python|
Clipboard integration |provider-clipboard|
OTHER FEATURES ~
USER EXPERIENCE ~
A major goal of Nvim is to work intuitively and consistently. For example,
Nvim does not have `-X`, a platform-specific option available in some Vim
builds (with potential surprises: http://stackoverflow.com/q/14635295). Nvim
avoids features that cannot be provided on all platforms--instead that is
delegated to external plugins/extensions.
ARCHITECTURE ~
External plugins run in separate processes. |remote-plugin| This improves
stability and allows those plugins to perform tasks without blocking the
editor. Even "legacy" Python and Ruby plugins which use the old Vim interfaces
(|if_py| and |if_ruby|) run out-of-process.
FEATURES ~
|bracketed-paste-mode| is built-in and enabled by default.
Meta (alt) chords are recognized (even in the terminal).
<M-1>, <M-2>, ...
<M-BS>, <M-Del>, <M-Ins>, ...
<M-/>, <M-\>, ...
<M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
Note: Meta chords are case-sensitive (<M-a> is distinguished from <M-A>).
|META| (ALT) chords are recognized, even in the terminal. Any |<M-| mapping
will work. Some examples: <M-1>, <M-2>, <M-BS>, <M-Del>, <M-Ins>, <M-/>,
<M-\>, <M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
META chords are case-sensitive: <M-a> and <M-A> are two different keycodes.
Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants
(even in the terminal). Specifically, the following are known to work:
<C-Tab>, <C-S-Tab>
<C-BS>, <C-S-BS>
<C-Enter>, <C-S-Enter>
<C-Tab>, <C-S-Tab>, <C-BS>, <C-S-BS>, <C-Enter>, <C-S-Enter>
Options:
'inccommand' shows results while typing a |:substitute| command
'statusline' supports unlimited alignment sections
'tabline' %@Func@foo%X can call any function on mouse-click
Variables:
|v:event|
|v:windowid| is always available (for use by external UIs)
Commands:
|:CheckHealth|
|:drop| is available on all platforms
|:Man| is available by default, with many improvements such as completion
Functions:
|dictwatcheradd()| notifies a callback whenever a |Dict| is modified
|dictwatcherdel()|
|execute()| works with |:redir|
|msgpackdump()|, |msgpackparse()| provide msgpack de/serialization
Events:
|TabNew|
|TabNewEntered|
|TabClosed|
|TermOpen|
|TermClose|
|TermOpen|
|TextYankPost|
Highlight groups:
|hl-EndOfBuffer|
|hl-QuickFixLine|
|hl-Substitute|
|hl-TermCursor|
|hl-TermCursorNC|
@@ -127,10 +150,10 @@ are always available and may be used simultaneously in separate plugins. The
`neovim` pip package must be installed to use Python plugins in Nvim (see
|provider-python|).
|:!| and |system()| do not support "interactive" commands; use |:terminal| for
that instead. Terminal Vim supports interactive |:!| and |system()|, but gui
Vim does not. See ":help gui-pty" in Vim:
http://vimdoc.sourceforge.net/htmldoc/gui_x11.html#gui-pty
|:!| does not support "interactive" commands. Use |:terminal| instead.
(GUI Vim has a similar limitation, see ":help gui-pty" in Vim.)
|system()| does not support writing/reading "backgrounded" commands. |E5677|
|mkdir()| behaviour changed:
1. Assuming /tmp/foo does not exist and /tmp can be written to
@@ -140,7 +163,7 @@ Vim does not. See ":help gui-pty" in Vim:
'p')) mkdir() will silently exit. In Vim this was an error.
3. mkdir() error messages now include strerror() text when mkdir fails.
'encoding' cannot be changed after startup.
'encoding' is always "utf-8".
|string()| and |:echo| behaviour changed:
1. No maximum recursion depth limit is applied to nested container
@@ -219,10 +242,12 @@ planned for the current milestone.
These features are in Vim, but have been intentionally removed from Nvim.
Vi-compatible mode:
*'cp'* *'nocompatible'* *'nocp'* *'compatible'*
Nvim is always "non-compatible" with Vi.
":set nocompatible" is ignored
":set compatible" is an error
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
Ed-compatible mode:
":set noedcompatible" is ignored
":set edcompatible" is an error
@@ -232,8 +257,8 @@ Ed-compatible mode:
":set nottyfast" is an error
Encryption support:
'cryptmethod'
'key'
*'cryptmethod'* *'cm'*
*'key'*
MS-DOS support:
'bioskey'
@@ -244,27 +269,28 @@ Highlight groups:
Other options:
'antialias'
'cpoptions' ('g', 'w', 'H', '*', '-', 'j', and all POSIX flags were removed)
'guioptions' (only the 't' flag was removed)
'guipty'
'imactivatefunc'
'imactivatekey'
'imstatusfunc'
'macatsui'
'restorescreen'
'cpoptions' ("g", "w", "H", "*", "-", "j", and all POSIX flags were removed)
'encoding' ("utf-8" is always used)
'guioptions' "t" flag was removed
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
*'imactivatefunc'* *'imaf'*
*'imactivatekey'* *'imak'*
*'imstatusfunc'* *'imsf'*
*'macatsui'*
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
'shelltype'
'shortname'
'swapsync'
'term'
'termencoding' (Vim 7.4.852 also removed this for Windows)
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
*'swapsync'* *'sws'*
*'term'* *E529* *E530* *E531*
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
'textauto'
'textmode'
'toolbar'
'toolbariconsize'
'ttybuiltin'
'ttymouse'
'ttyscroll'
'ttytype'
*'toolbar'* *'tb'*
*'toolbariconsize'* *'tbis'*
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
*'ttymouse'* *'ttym'*
*'ttyscroll'* *'tsl'*
*'ttytype'* *'tty'*
'weirdinvert'
Other commands:
@@ -274,6 +300,7 @@ Other commands:
:mode (no longer accepts an argument)
:open
:shell
:smile
:tearoff
Other compile-time features:

View File

@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2015 Oct 13
" Last Change: 2016 Jul 12
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -1617,11 +1617,9 @@ au BufNewFile,BufRead */etc/protocols setf protocols
" Pyrex
au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
" Python
au BufNewFile,BufRead *.py,*.pyw setf python
" Python, Python Shell Startup Files
" Quixote (Python-based web framework)
au BufNewFile,BufRead *.ptl setf python
au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl setf python
" Radiance
au BufNewFile,BufRead *.rad,*.mat setf radiance

View File

@@ -55,5 +55,7 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
endif
endif
let b:man_default_sects = '3,2'
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -0,0 +1,19 @@
" Vim filetype plugin file
" Language: groovy
" Maintainer: Justin M. Keyes <justinkz@gmail.com>
" Last Change: 2016 May 22
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo-=C
let b:undo_ftplugin = 'setlocal commentstring<'
setlocal commentstring=//%s
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,25 +1,15 @@
" Maintainer: Anmol Sethi <anmol@aubble.com>
" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
if exists('b:did_ftplugin') || &filetype !=# 'man'
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
let s:pager = 0
let s:pager = !exists('b:man_sect')
if has('vim_starting')
let s:pager = 1
" remove all those backspaces
silent execute 'keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
if getline(1) =~# '^\s*$'
silent keepjumps 1delete _
else
keepjumps 1
endif
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
" all caps it is impossible to tell what the original capitilization was.
execute 'file man://'.tolower(matchstr(getline(1), '^\S\+'))
if s:pager
call man#init_pager()
endif
setlocal buftype=nofile
@@ -41,8 +31,8 @@ setlocal nolist
setlocal nofoldenable
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
nmap <silent> <buffer> <C-]> <Plug>(Man)
nmap <silent> <buffer> K <Plug>(Man)
nmap <silent> <buffer> <C-]> :Man<CR>
nmap <silent> <buffer> K :Man<CR>
nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
if s:pager
nnoremap <silent> <buffer> <nowait> q :q<CR>

View File

@@ -2,7 +2,7 @@
" Header: "{{{
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
" Last Change: 2015 Sep 25
" Last Change: 2016 Mar 30
" Version: 1.0
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -240,13 +240,13 @@ call s:AddITags(s:indent_tags, [
\ 'sup', 'table', 'textarea', 'title', 'tt', 'u', 'ul', 'var', 'th', 'td',
\ 'tr', 'tbody', 'tfoot', 'thead'])
" Tags added 2011 Sep 09 (especially HTML5 tags):
" New HTML5 elements:
call s:AddITags(s:indent_tags, [
\ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas',
\ 'command', 'datalist', 'details', 'embed', 'figure', 'footer',
\ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output',
\ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video',
\ 'wbr', 'text'])
\ 'command', 'data', 'datalist', 'details', 'embed', 'figcaption',
\ 'figure', 'footer', 'header', 'keygen', 'mark', 'meter', 'nav', 'output',
\ 'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', 'svg',
\ 'time', 'track', 'video', 'wbr'])
" Tags added for web components:
call s:AddITags(s:indent_tags, [

View File

@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2016 Mar 19
" Last Change: 2016 Apr 21
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@@ -710,6 +710,10 @@ call <SID>Header("editing text")
call append("$", "undolevels\tmaximum number of changes that can be undone")
call append("$", "\t(global or local to buffer)")
call append("$", " \tset ul=" . &ul)
call append("$", "undofile\tautomatically save and restore undo history")
call <SID>BinOptionG("udf", &udf)
call append("$", "undodir\tlist of directories for undo files")
call <SID>OptionG("udir", &udir)
call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload")
call append("$", " \tset ur=" . &ur)
call append("$", "modified\tchanges have been made and not written to a file")
@@ -1032,10 +1036,6 @@ if has("vertsplit")
call append("$", "cmdwinheight\theight of the command-line window")
call <SID>OptionG("cwh", &cwh)
endif
call append("$", "undofile\tautomatically save and restore undo history")
call <SID>BinOptionG("udf", &udf)
call append("$", "undodir\tlist of directories for undo files")
call <SID>OptionG("udir", &udir)
call <SID>Header("executing external commands")
@@ -1195,6 +1195,8 @@ if has("multi_byte")
endif
call append("$", "ambiwidth\twidth of ambiguous width characters")
call <SID>OptionG("ambw", &ambw)
call append("$", "emoji\temoji characters are full width")
call <SID>BinOptionG("emo", &emo)
endif

View File

@@ -5,9 +5,7 @@ if exists('g:loaded_man')
endif
let g:loaded_man = 1
command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <f-args>)
nnoremap <silent> <Plug>(Man) :<C-U>call man#open_page(v:count, v:count1, &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>'))<CR>
command! -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>)
augroup man
autocmd!

View File

@@ -123,7 +123,6 @@ function! s:Match_wrapper(word, forward, mode) range
" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion!
if (match_words != s:last_words) || (&mps != s:last_mps) ||
\ exists("b:match_debug")
let s:last_words = match_words
let s:last_mps = &mps
" The next several lines were here before
" BF started messing with this script.
@@ -135,6 +134,7 @@ function! s:Match_wrapper(word, forward, mode) range
\ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>'
" s:all = pattern with all the keywords
let match_words = match_words . (strlen(match_words) ? "," : "") . default
let s:last_words = match_words
if match_words !~ s:notslash . '\\\d'
let s:do_BR = 0
let s:pat = match_words

View File

@@ -1,7 +1,7 @@
" Vim support file to detect file types in scripts
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2014 Aug 24
" Last change: 2016 May 21
" This file is called by an autocommand for every file that has just been
" loaded into a buffer. It checks if the type of file can be recognized by
@@ -240,7 +240,8 @@ else
set ft=xhtml
" HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
" Avoid "doctype html", used by slim.
elseif s:line1 =~? '<!DOCTYPE\s\+html\>'
set ft=html
" PDF

View File

@@ -61,6 +61,7 @@ an 50.10.320 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc")<CR>
an 50.10.330 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs")<CR>
an 50.10.340 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl")<CR>
an 50.10.350 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k")<CR>
an 50.10.355 &Syntax.AB.Assembly.AVR :cal SetSyn("avra")<CR>
an 50.10.360 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm")<CR>
an 50.10.370 &Syntax.AB.Assembly.GNU :cal SetSyn("asm")<CR>
an 50.10.380 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300")<CR>

73
runtime/syntax/avra.vim Normal file
View File

@@ -0,0 +1,73 @@
" Vim syntax file
" Language: AVR Assembler (AVRA)
" AVRA Home: http://avra.sourceforge.net/index.html
" AVRA Version: 1.3.0
" Maintainer: Marius Ghita <mhitza@gmail.com>
let s:cpo_save = &cpo
set cpo&vim
setlocal iskeyword=a-z,A-Z,48-57,.,_
" 'isident' is a global option, better not set it
" setlocal isident=a-z,A-Z,48-57,.,_
syn case ignore
syn keyword avraRegister r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14
syn keyword avraRegister r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27
syn keyword avraRegister r28 r29 r30 r31
syn keyword avraInstr add adc adiw sub subi sbc sbci sbiw and andi or ori eor
syn keyword avraInstr com neg sbr cbr inc dec tst clr ser mul muls mulsu fmul
syn keyword avraInstr fmuls fmulsu des rjmp ijmp eijmp jmp rcall icall eicall
syn keyword avraInstr call ret reti cpse cp cpc cpi sbrc sbrs sbic sbis brbs
syn keyword avraInstr brbc breq brne brcs brcc brsh brlo brmi brpl brge brlt
syn keyword avraInstr brhs brhc brts brtc brvs brvc brie brid mov movw ldi lds
syn keyword avraInstr ld ldd sts st std lpm elpm spm in out push pop xch las
syn keyword avraInstr lac lat lsl lsr rol ror asr swap bset bclr sbi cbi bst bld
syn keyword avraInstr sec clc sen cln sez clz sei cli ses cls sev clv set clt
syn keyword avraInstr seh clh break nop sleep wdr
syn keyword avraDirective .byte .cseg .db .def .device .dseg .dw .endmacro .equ
syn keyword avraDirective .eseg .exit .include .list .listmac .macro .nolist
syn keyword avraDirective .org .set .define .undef .ifdef .ifndef .if .else
syn keyword avraDirective .elif .elseif .warning
syn keyword avraOperator low high byte2 byte3 byte4 lwrd hwrd page exp2 log2
syn match avraNumericOperator "[-*/+]"
syn match avraUnaryOperator "!"
syn match avraBinaryOperator "<<\|>>\|<\|<=\|>\|>=\|==\|!="
syn match avraBitwiseOperator "[~&^|]\|&&\|||"
syn match avraBinaryNumber "\<0[bB][0-1]*\>"
syn match avraHexNumber "\<0[xX][0-9a-fA-F]\+\>"
syn match avraDecNumber "\<\(0\|[1-9]\d*\)\>"
syn region avraComment start=";" end="$"
syn region avraString start="\"" end="\"\|$"
syn match avraLabel "^\s*[^; \t]\+:"
hi def link avraBinaryNumber avraNumber
hi def link avraHexNumber avraNumber
hi def link avraDecNumber avraNumber
hi def link avraNumericOperator avraOperator
hi def link avraUnaryOperator avraOperator
hi def link avraBinaryOperator avraOperator
hi def link avraBitwiseOperator avraOperator
hi def link avraOperator operator
hi def link avraComment comment
hi def link avraDirective preproc
hi def link avraRegister type
hi def link avraNumber constant
hi def link avraString String
hi def link avraInstr keyword
hi def link avraLabel label
let b:current_syntax = "avra"
let &cpo = s:cpo_save
unlet s:cpo_save

View File

@@ -1,15 +1,15 @@
" Vim syntax file
" Language: awk, nawk, gawk, mawk
" Maintainer: Antonio Colombo <azc100@gmail.com>
" Last Change: 2014 Oct 21
" Last Change: 2016 Jul 15
" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
" The AWK Programming Language, Addison-Wesley, 1988
" GAWK ref. is: Arnold D. Robbins
" Effective AWK Programming, Third Edition, O'Reilly, 2001
" Effective AWK Programming, Fourth Edition, O'Reilly, 2015
" (also available with the gawk source distribution)
" (also available and updated with the gawk source distribution)
" MAWK is a "new awk" meaning it implements AWK ref.
" mawk conforms to the Posix 1003.2 (draft 11.3)
@@ -19,11 +19,8 @@
" TODO:
" Dig into the commented out syntax expressions below.
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syn clear
elseif exists("b:current_syntax")
" Quit when a syntax file was already loaded
if exists("b:current_syntax")
finish
endif
@@ -35,13 +32,13 @@ set cpo&vim
syn keyword awkStatement break continue delete exit
syn keyword awkStatement function getline next
syn keyword awkStatement print printf return
" GAWK ref. Chapter 7
syn keyword awkStatement nextfile
" GAWK ref. Chapter 7-9
syn keyword awkStatement switch nextfile
syn keyword awkStatement func
"
" GAWK ref. Chapter 9, Functions
"
" Numeric Functions
syn keyword awkFunction atan2 cos div exp int log rand sin sqrt srand
syn keyword awkFunction atan2 cos exp int intdiv log rand sin sqrt srand
" String Manipulation Functions
syn keyword awkFunction asort asort1 gensub gsub index length match
syn keyword awkFunction patsplit split sprintf strtonum sub substr
@@ -52,17 +49,17 @@ syn keyword awkFunction close fflush system
syn keyword awkFunction mktime strftime systime
" Bit Manipulation Functions
syn keyword awkFunction and compl lshift or rshift xor
" Getting Type Function
syn keyword awkFunction isarray
" Getting Type Functions
syn keyword awkFunction isarray typeof
" String-Translation Functions
syn keyword awkFunction bindtextdomain dcgettext dcngetext
syn keyword awkConditional if else
syn keyword awkRepeat while for
syn keyword awkRepeat while for do
syn keyword awkTodo contained TODO
syn keyword awkTodo contained TODO
syn keyword awkPatterns BEGIN END
syn keyword awkPatterns BEGIN END BEGINFILE ENDFILE
" GAWK ref. Chapter 7
" Built-in Variables That Control awk
@@ -74,20 +71,18 @@ syn keyword awkVariables ARGC ARGV ARGIND ENVIRON ERRNO FILENAME
syn keyword awkVariables FNR NF FUNCTAB NR PROCINFO RLENGTH RSTART
syn keyword awkVariables RT SYMTAB
syn keyword awkRepeat do
" Octal format character.
syn match awkSpecialCharacter display contained "\\[0-7]\{1,3\}"
syn keyword awkStatement func nextfile
" Hex format character.
syn match awkSpecialCharacter display contained "\\x[0-9A-Fa-f]\+"
syn match awkFieldVars "\$\d\+"
"catch errors caused by wrong parenthesis
syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass
" catch errors caused by wrong parenthesis
syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass,awkComment
syn match awkParenError display ")"
syn match awkInParen display contained "[{}]"
"syn match awkInParen display contained "[{}]"
" 64 lines for complex &&'s, and ||'s in a big "if"
syn sync ccomment awkParen maxlines=64
@@ -141,7 +136,7 @@ syn match awkExpression "?\|:"
syn keyword awkExpression in
" Boolean Logic (OR, AND, NOT)
"syn match awkBoolLogic "||\|&&\|\!"
syn match awkBoolLogic "||\|&&\|\!"
" This is overridden by less-than & greater-than.
" Put this above those to override them.
@@ -171,63 +166,42 @@ syn region awkArray transparent start="\[" end="\]" contains=awkArray,awkArrayE
" (for the few instances where it would be more than "oneline")
syn sync ccomment awkArray maxlines=10
" define the default highlighting
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_awk_syn_inits")
if version < 508
let did_awk_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
HiLink awkConditional Conditional
HiLink awkFunction Function
HiLink awkRepeat Repeat
HiLink awkStatement Statement
HiLink awkString String
HiLink awkSpecialPrintf Special
HiLink awkSpecialCharacter Special
HiLink awkSearch String
HiLink awkBrackets awkRegExp
HiLink awkBrktRegExp awkNestRegExp
HiLink awkCharClass awkNestRegExp
HiLink awkNestRegExp Keyword
HiLink awkRegExp Special
HiLink awkNumber Number
HiLink awkFloat Float
HiLink awkFileIO Special
HiLink awkOperator Special
HiLink awkExpression Special
HiLink awkBoolLogic Special
HiLink awkPatterns Special
HiLink awkVariables Special
HiLink awkFieldVars Special
HiLink awkLineSkip Special
HiLink awkSemicolon Special
HiLink awkComma Special
"HiLink awkIdentifier Identifier
HiLink awkComment Comment
HiLink awkTodo Todo
" Change this if you want nested array names to be highlighted.
HiLink awkArrayArray awkArray
HiLink awkArrayElement Special
HiLink awkParenError awkError
HiLink awkInParen awkError
HiLink awkError Error
delcommand HiLink
endif
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link awkConditional Conditional
hi def link awkFunction Function
hi def link awkRepeat Repeat
hi def link awkStatement Statement
hi def link awkString String
hi def link awkSpecialPrintf Special
hi def link awkSpecialCharacter Special
hi def link awkSearch String
hi def link awkBrackets awkRegExp
hi def link awkBrktRegExp awkNestRegExp
hi def link awkCharClass awkNestRegExp
hi def link awkNestRegExp Keyword
hi def link awkRegExp Special
hi def link awkNumber Number
hi def link awkFloat Float
hi def link awkFileIO Special
hi def link awkOperator Special
hi def link awkExpression Special
hi def link awkBoolLogic Special
hi def link awkPatterns Special
hi def link awkVariables Special
hi def link awkFieldVars Special
hi def link awkLineSkip Special
hi def link awkSemicolon Special
hi def link awkComma Special
hi def link awkIdentifier Identifier
hi def link awkComment Comment
hi def link awkTodo Todo
" Change this if you want nested array names to be highlighted.
hi def link awkArrayArray awkArray
hi def link awkArrayElement Special
hi def link awkParenError awkError
hi def link awkInParen awkError
hi def link awkError Error
let b:current_syntax = "awk"

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: DCL (Digital Command Language - vms)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Last Change: Jan 20, 2016
" Version: 8
" Last Change: May 02, 2016
" Version: 9
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL
" For version 5.x: Clear all syntax items
@@ -13,7 +13,7 @@ elseif exists("b:current_syntax")
finish
endif
if !has("patch-7.4.1141")
if !has("patch-7.4.1142")
setlocal iskeyword=$,@,48-57,_
else
syn iskeyword $,@,48-57,_

View File

@@ -3,7 +3,7 @@
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
" Wichert Akkerman <wakkerma@debian.org>
" Last Change: 2015 Oct 24
" Last Change: 2016 Apr 24
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim
" Standard syntax initialization
@@ -23,7 +23,7 @@ let binNMU='binary-only=yes'
syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ "
exe 'syn match debchangelogFirstKV contained "; \('.urgency.'\|'.binNMU.'\)"'
exe 'syn match debchangelogOtherKV contained ", \('.urgency.'\|'.binNMU.'\)"'
syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial)%(-%(security|proposed|updates|backports|commercial|partner))=)+"
syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial|yakkety)%(-%(security|proposed|updates|backports|commercial|partner))=)+"
syn match debchangelogVersion contained "(.\{-})"
syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*"
syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*"

View File

@@ -2,7 +2,7 @@
" Language: Debian sources.list
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
" Last Change: 2015 Oct 24
" Last Change: 2016 Apr 24
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim
" Standard syntax initialization
@@ -27,7 +27,7 @@ let s:supported = [
\ 'oldstable', 'stable', 'testing', 'unstable', 'experimental',
\ 'squeeze', 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy',
\
\ 'precise', 'trusty', 'vivid', 'wily', 'xenial', 'devel'
\ 'precise', 'trusty', 'wily', 'xenial', 'yakkety', 'devel'
\ ]
let s:unsupported = [
\ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
@@ -36,7 +36,7 @@ let s:unsupported = [
\ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
\ 'maverick', 'natty', 'oneiric', 'quantal', 'raring', 'saucy',
\ 'utopic'
\ 'utopic', 'vivid'
\ ]
let &cpo=s:cpo

View File

@@ -3,7 +3,8 @@
" according to freedesktop.org specification 0.9.4
" http://pdx.freedesktop.org/Standards/desktop-entry-spec/desktop-entry-spec-0.9.4.html
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
" Last Change: 2004 May 16
" Last Change: 2016 Apr 02
" (added "Keywords")
" Version Info: desktop.vim 0.9.4-1.2
" For version 5.x: Clear all syntax items
@@ -53,8 +54,8 @@ syn keyword dtBooleanKey StartupNotify ReadOnly Terminal Hidden NoDisplay nextgr
syn keyword dtBooleanValue true false containedin=dtBoolean contained
" String
syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent
syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained
syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Keywords\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent
syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Keywords Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained
" Exec
syn match dtExec /^\s*\<\(Exec\|TryExec\|SwallowExec\)\>.*/ contains=dtExecKey,dtDelim,dtExecParam transparent

View File

@@ -2,7 +2,7 @@
" Language: Diff (context or unified)
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Translations by Jakson Alves de Aquino.
" Last Change: 2015 Feb 03
" Last Change: 2016 Apr 02
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -342,7 +342,7 @@ syn match diffLine "^\<\d\+\>.*"
syn match diffLine "^\*\*\*\*.*"
syn match diffLine "^---$"
"Some versions of diff have lines like "#c#" and "#d#" (where # is a number)
" Some versions of diff have lines like "#c#" and "#d#" (where # is a number)
syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
syn match diffFile "^diff\>.*"
@@ -352,12 +352,16 @@ syn match diffFile "^==== .*"
syn match diffOldFile "^\*\*\* .*"
syn match diffNewFile "^--- .*"
" Used by git
syn match diffIndexLine "^index \x\x\x\x.*"
syn match diffComment "^#.*"
" Define the default highlighting.
" Only used when an item doesn't have highlighting yet
hi def link diffOldFile diffFile
hi def link diffNewFile diffFile
hi def link diffIndexLine PreProc
hi def link diffFile Type
hi def link diffOnly Constant
hi def link diffIdentical Constant

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.14
" Version: 0.1.16
" URL: http://www.vim.org/scripts/script.php?script_id=945
" Last Change: 2015 Apr 21
" Last Change: 2016 May 23
" THE ORIGINAL AUTHOR'S NOTES:
"
@@ -255,8 +255,11 @@ syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpeci
syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell
syn region groovyString start=+"""+ end=+"""+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
syn region groovyString start=+'''+ end=+'''+ contains=groovySpecialChar,groovySpecialError,@Spell
" regex string
syn region groovyString start='/[^/]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
if exists("groovy_regex_strings")
" regex strings interfere with the division operator and thus are disabled
" by default
syn region groovyString start='/[^/*]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
endif
" syn region groovyELExpr start=+${+ end=+}+ keepend contained
syn match groovyELExpr /\${.\{-}}/ contained
syn match groovyELExpr /\$[a-zA-Z_][a-zA-Z0-9_.]*/ contained

View File

@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Vim help file
" Maintainer: Bram Moolenaar (Bram@vim.org)
" Last Change: 2014 Feb 12
" Last Change: 2016 Apr 01
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -41,6 +41,7 @@ syn match helpVim "NVIM REFERENCE.*"
syn match helpOption "'[a-z]\{2,\}'"
syn match helpOption "'t_..'"
syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
if has("conceal")

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Lisp
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Last Change: Jan 20, 2016
" Version: 24
" Last Change: May 02, 2016
" Version: 25
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP
"
" Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec
@@ -16,7 +16,7 @@ endif
if exists("g:lisp_isk")
exe "setl isk=".g:lisp_isk
elseif !has("patch-7.4.1141")
elseif !has("patch-7.4.1142")
setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_
else
syn iskeyword 38,42,43,45,47-58,60-62,64-90,97-122,_

View File

@@ -7,10 +7,10 @@ endif
syntax case ignore
syntax match manReference display '[^()[:space:]]\+([0-9nx][a-z]*)'
syntax match manSectionHeading display '^\%(\S.*\)\=\S$'
syntax match manSectionHeading display '^\S.*$'
syntax match manTitle display '^\%1l.*$'
syntax match manSubHeading display '^ \{3\}\S.*$'
syntax match manOptionDesc display '^\s\+\%(+\|--\=\)\S\+'
syntax match manOptionDesc display '^\s\+\%(+\|-\)\S\+'
highlight default link manTitle Title
highlight default link manSectionHeading Statement
@@ -18,7 +18,10 @@ highlight default link manOptionDesc Constant
highlight default link manReference PreProc
highlight default link manSubHeading Function
if getline(1) =~# '^[^()[:space:]]\+([23].*'
if !exists('b:man_sect')
call man#init_pager()
endif
if b:man_sect =~# '^[23]'
syntax include @c $VIMRUNTIME/syntax/c.vim
syntax match manCFuncDefinition display '\<\h\w*\>\ze\(\s\|\n\)*(' contained
syntax region manSynopsis start='^\%(

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: Maple V (based on release 4)
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Last Change: Jan 20, 2016
" Version: 12
" Last Change: May 02, 2016
" Version: 13
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE
"
" Package Function Selection: {{{1
@@ -30,7 +30,7 @@ elseif exists("b:current_syntax")
endif
" Iskeyword Effects: {{{1
if !has("patch-7.4.1141")
if !has("patch-7.4.1142")
setl isk=$,48-57,_,a-z,@-Z
else
syn iskeyword $,48-57,_,a-z,@-Z

View File

@@ -1,6 +1,6 @@
" Vim syntax file
" Language: Scheme (R5RS + some R6RS extras)
" Last Change: 2012 May 13
" Last Change: 2016 May 23
" Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
" Original author: Dirk van Deun <dirk@igwe.vub.ac.be>
@@ -245,6 +245,18 @@ if exists("b:is_mzscheme") || exists("is_mzscheme")
syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL
syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL
syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL
" Identifiers are very liberal in MzScheme/Racket
syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+!
" Language setting
syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>"
" Various number forms
syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>"
syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>"
syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>"
syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>"
endif
@@ -321,6 +333,9 @@ if version >= 508 || !exists("did_scheme_syntax_inits")
HiLink schemeExtSyntax Type
HiLink schemeExtFunc PreProc
HiLink schemeLang PreProc
delcommand HiLink
endif

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: Apr 11, 2016
" Version: 147
" Last Change: May 02, 2016
" Version: 151
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
" For options and settings, please use: :help ft-sh-syntax
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr)
@@ -18,19 +18,25 @@ endif
" trying to answer the question: which shell is /bin/sh, really?
" If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess.
if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
if getline(1) =~ '\<ksh$'
let b:is_kornshell = 1
elseif getline(1) =~ '\<bash$'
let b:is_bash = 1
elseif getline(1) =~ '\<dash$'
let b:is_posix = 1
elseif !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
let s:shell = ""
if executable("/bin/sh")
let s:shell = resolve("/bin/sh")
elseif executable("/usr/bin/sh")
let s:shell = resolve("/usr/bin/sh")
endif
if s:shell =~ 'bash$'
let g:is_bash= 1
elseif s:shell =~ 'ksh$'
let g:is_kornshell = 1
if s:shell =~ 'ksh$'
let b:is_kornshell= 1
elseif s:shell =~ 'bash$'
let b:is_bash = 1
elseif s:shell =~ 'dash$'
let g:is_posix = 1
let b:is_posix = 1
endif
unlet s:shell
endif
@@ -86,8 +92,12 @@ if g:sh_fold_enabled && &fdm == "manual"
endif
" set up the syntax-highlighting iskeyword
if has("patch-7.4.1141")
exe "syn iskeyword ".&iskeyword.",-"
if has("patch-7.4.1142")
if exists("b:is_bash")
exe "syn iskeyword ".&iskeyword.",-,:"
else
exe "syn iskeyword ".&iskeyword.",-"
endif
endif
" Set up folding commands for shell {{{1
@@ -140,6 +150,7 @@ syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch
syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm
syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
@@ -213,14 +224,15 @@ syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")"
syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial
syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' contained
syn match shAstQuote contained '\*\ze"' nextgroup=shString
syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
syn match shTestOpr contained "<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
syn match shTestPattern contained '\w\+'
syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"'
syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' contains=shDeref,shDerefSimple,shDerefSpecial
syn match shTestSingleQuote contained '\\.'
syn match shTestSingleQuote contained "'[^']*'"
if exists("b:is_kornshell") || exists("b:is_bash")
syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shNoQuote,shComment
syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shAstQuote,shNoQuote,shComment
syn region shDblParen matchgroup=Delimiter start="((" skip=+\%(\\\\\)*\\$+ end="))" contains=@shTestList,shComment
endif
@@ -313,7 +325,9 @@ syn match shSource "^\.\s"
syn match shSource "\s\.\s"
"syn region shColon start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList
"syn region shColon start="^\s*\zs:" end="$" end="\s#"me=e-2
syn match shColon '^\s*\zs:'
if exists("b:is_kornshell")
syn match shColon '^\s*\zs:'
endif
" String And Character Constants: {{{1
"================================
@@ -404,21 +418,21 @@ if !exists("g:is_posix")
endif
if exists("b:is_bash")
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
else
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
endif
" Parameter Dereferencing: {{{1
" ========================
if !exists("g:sh_no_error")
syn match shDerefWordError "[^}$[]" contained
syn match shDerefWordError "[^}$[~]" contained
endif
syn match shDerefSimple "\$\%(\k\+\|\d\)"
syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
@@ -498,7 +512,7 @@ if exists("b:is_bash")
" bash : ${parameter//pattern}
syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList
syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList
" bash : ${parameter/#substring/replacement}
syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft
@@ -567,6 +581,7 @@ syn sync match shWhileSync grouphere shRepeat "\<while\>"
" Default Highlighting: {{{1
" =====================
hi def link shArithRegion shShellVariables
hi def link shAstQuote shDoubleQuote
hi def link shAtExpr shSetList
hi def link shBeginHere shRedir
hi def link shCaseBar shConditional
@@ -597,7 +612,6 @@ hi def link shEmbeddedEcho shString
hi def link shEscape shCommandSub
hi def link shExDoubleQuote shDoubleQuote
hi def link shExSingleQuote shSingleQuote
hi def link shFunction Function
hi def link shHereDoc shString
hi def link shHerePayload shHereDoc
hi def link shLoop shStatement
@@ -628,21 +642,17 @@ if exists("b:is_bash")
hi def link bashAdminStatement shStatement
hi def link bashSpecialVariables shShellVariables
hi def link bashStatement shStatement
hi def link shFunctionParen Delimiter
hi def link shFunctionDelim Delimiter
hi def link shCharClass shSpecial
endif
if exists("b:is_kornshell")
hi def link kshSpecialVariables shShellVariables
hi def link kshStatement shStatement
hi def link shFunctionParen Delimiter
endif
if !exists("g:sh_no_error")
hi def link shCaseError Error
hi def link shCondError Error
hi def link shCurlyError Error
hi def link shDerefError Error
hi def link shDerefOpError Error
hi def link shDerefWordError Error
hi def link shDoError Error

View File

@@ -4,8 +4,8 @@
" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
" Contributor: Karsten Hopp <karsten@redhat.com>
" Last Change: 2016 Mar 1
" SSH Version: 7.2
" Last Change: 2016 Apr 7
" SSH Version: 7.2p2
"
" Setup
@@ -36,7 +36,7 @@ syn keyword sshconfigTodo TODO FIXME NOTE contained
" Constants
syn keyword sshconfigYesNo yes no ask
syn keyword sshconfigYesNo yes no ask confirm
syn keyword sshconfigYesNo any auto
syn keyword sshconfigYesNo force autoask none
@@ -139,6 +139,7 @@ syn keyword sshconfigHostSect Host
syn keyword sshconfigMatch canonical exec host originalhost user localuser all
syn keyword sshconfigKeyword AddressFamily
syn keyword sshconfigKeyword AddKeysToAgent
syn keyword sshconfigKeyword BatchMode
syn keyword sshconfigKeyword BindAddress
syn keyword sshconfigKeyword CanonicalDomains

View File

@@ -1,8 +1,8 @@
" Vim syntax file
" Language: TeX
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
" Last Change: Apr 11, 2016
" Version: 94
" Last Change: May 02, 2016
" Version: 95
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
"
" Notes: {{{1
@@ -133,7 +133,7 @@ endif
" g:tex_isk
if exists("g:tex_isk")
exe "setlocal isk=".g:tex_isk
elseif !has("patch-7.4.1141")
elseif !has("patch-7.4.1142")
setl isk=48-57,a-z,A-Z,192-255
else
syn iskeyword 48-57,a-z,A-Z,192-255

View File

@@ -1,145 +1,135 @@
" Vim syntax file
" Language: HMTL Tidy configuration file (/etc/tidyrc ~/.tidyrc)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2013 June 01
" Last Change: 2016 Apr 24
if exists("b:current_syntax")
finish
endif
setlocal iskeyword=@,48-57,-
let s:cpo_save = &cpo
set cpo&vim
syn iskeyword @,48-57,-,_
syn case ignore
syn keyword tidyBoolean contained t[rue] f[alse] y[es] n[o] 1 0
syn keyword tidyAutoBoolean contained t[rue] f[alse] y[es] n[o] 1 0 auto
syn case match
syn keyword tidyDoctype contained html5 omit auto strict loose transitional user
syn keyword tidyEncoding contained raw ascii latin0 latin1 utf8 iso2022 mac win1252 ibm858 utf16le utf16be utf16 big5 shiftjis
syn keyword tidyNewline contained LF CRLF CR
syn match tidyNumber contained "\<\d\+\>"
syn keyword tidyRepeat contained keep-first keep-last
syn keyword tidySorter contained alpha none
syn region tidyString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline
syn region tidyString contained start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline
syn match tidyTags contained "\<\w\+\(\s*,\s*\w\+\)*\>"
syn keyword tidyBooleanOption add-xml-decl add-xml-pi add-xml-space
\ anchor-as-name ascii-chars assume-xml-procins bare break-before-br
\ clean coerce-endtags decorate-inferred-ul drop-empty-paras
\ drop-empty-elements drop-font-tags drop-proprietary-attributes
\ enclose-block-text enclose-text escape-cdata escape-scripts
\ fix-backslash fix-bad-comments fix-uri force-output gdoc gnu-emacs
\ hide-comments hide-endtags indent-attributes indent-cdata
\ indent-with-tabs input-xml join-classes join-styles keep-time
\ language literal-attributes logical-emphasis lower-literals markup
\ merge-emphasis ncr numeric-entities omit-optional-tags output-html
\ output-xhtml output-xml preserve-entities punctuation-wrap quiet
\ quote-ampersand quote-marks quote-nbsp raw replace-color show-info
\ show-warnings skip-nested split strict-tags-attributes tidy-mark
\ uppercase-attributes uppercase-tags word-2000 wrap-asp
\ wrap-attributes wrap-jste wrap-php wrap-script-literals
\ wrap-sections write-back
\ contained nextgroup=tidyBooleanDelimiter
syn match tidyBooleanDelimiter ":" nextgroup=tidyBoolean contained skipwhite
syn keyword tidyAutoBooleanOption indent merge-divs merge-spans output-bom show-body-only vertical-space contained nextgroup=tidyAutoBooleanDelimiter
syn match tidyAutoBooleanDelimiter ":" nextgroup=tidyAutoBoolean contained skipwhite
syn keyword tidyCSSSelectorOption css-prefix contained nextgroup=tidyCSSSelectorDelimiter
syn match tidyCSSSelectorDelimiter ":" nextgroup=tidyCSSSelector contained skipwhite
syn keyword tidyDoctypeOption doctype contained nextgroup=tidyDoctypeDelimiter
syn match tidyDoctypeDelimiter ":" nextgroup=tidyDoctype contained skipwhite
syn keyword tidyEncodingOption char-encoding input-encoding output-encoding contained nextgroup=tidyEncodingDelimiter
syn match tidyEncodingDelimiter ":" nextgroup=tidyEncoding contained skipwhite
syn keyword tidyIntegerOption accessibility-check doctype-mode indent-spaces show-errors tab-size wrap contained nextgroup=tidyIntegerDelimiter
syn match tidyIntegerDelimiter ":" nextgroup=tidyNumber contained skipwhite
syn keyword tidyNameOption slide-style contained nextgroup=tidyNameDelimiter
syn match tidyNameDelimiter ":" nextgroup=tidyName contained skipwhite
syn keyword tidyNewlineOption newline contained nextgroup=tidyNewlineDelimiter
syn match tidyNewlineDelimiter ":" nextgroup=tidyNewline contained skipwhite
syn keyword tidyTagsOption new-blocklevel-tags new-empty-tags new-inline-tags new-pre-tags contained nextgroup=tidyTagsDelimiter
syn match tidyTagsDelimiter ":" nextgroup=tidyTags contained skipwhite
syn keyword tidyRepeatOption repeated-attributes contained nextgroup=tidyRepeatDelimiter
syn match tidyRepeatDelimiter ":" nextgroup=tidyRepeat contained skipwhite
syn keyword tidySorterOption sort-attributes contained nextgroup=tidySorterDelimiter
syn match tidySorterDelimiter ":" nextgroup=tidySorter contained skipwhite
syn keyword tidyStringOption alt-text error-file gnu-emacs-file output-file contained nextgroup=tidyStringDelimiter
syn match tidyStringDelimiter ":" nextgroup=tidyString contained skipwhite
syn cluster tidyOptions contains=tidy.*Option
syn match tidyStart "^" nextgroup=@tidyOptions
syn match tidyComment "^\s*//.*$" contains=tidyTodo
syn match tidyComment "^\s*#.*$" contains=tidyTodo
syn keyword tidyTodo TODO NOTE FIXME XXX contained
syn match tidyAssignment "^[a-z0-9-]\+:\s*.*$" contains=tidyOption,@tidyValue,tidyDelimiter
syn match tidyDelimiter ":" contained
hi def link tidyAutoBooleanOption Identifier
hi def link tidyBooleanOption Identifier
hi def link tidyCSSSelectorOption Identifier
hi def link tidyDoctypeOption Identifier
hi def link tidyEncodingOption Identifier
hi def link tidyIntegerOption Identifier
hi def link tidyNameOption Identifier
hi def link tidyNewlineOption Identifier
hi def link tidyTagsOption Identifier
hi def link tidyRepeatOption Identifier
hi def link tidySorterOption Identifier
hi def link tidyStringOption Identifier
syn match tidyNewTagAssignment "^new-\l\+-tags:\s*.*$" contains=tidyNewTagOption,tidyNewTagDelimiter,tidyNewTagValue,tidyDelimiter
syn match tidyNewTagDelimiter "," contained
syn match tidyNewTagValue "\<\w\+\>" contained
hi def link tidyAutoBooleanDelimiter Special
hi def link tidyBooleanDelimiter Special
hi def link tidyCSSSelectorDelimiter Special
hi def link tidyDoctypeDelimiter Special
hi def link tidyEncodingDelimiter Special
hi def link tidyIntegerDelimiter Special
hi def link tidyNameDelimiter Special
hi def link tidyNewlineDelimiter Special
hi def link tidyTagsDelimiter Special
hi def link tidyRepeatDelimiter Special
hi def link tidySorterDelimiter Special
hi def link tidyStringDelimiter Special
syn case ignore
syn keyword tidyBoolean t[rue] f[alse] y[es] n[o] contained
syn case match
syn match tidyDoctype "\<\%(omit\|auto\|strict\|loose\|transitional\|user\)\>" contained
" NOTE: use match rather than keyword here so that tidyEncoding 'raw' does not
" always have precedence over tidyOption 'raw'
syn match tidyEncoding "\<\%(ascii\|latin0\|latin1\|raw\|utf8\|iso2022\|mac\|utf16le\|utf16be\|utf16\|win1252\|ibm858\|big5\|shiftjis\)\>" contained
syn match tidyNewline "\<\%(LF\|CRLF\|CR\)\>"
syn match tidyNumber "\<\d\+\>" contained
syn match tidyRepeat "\<\%(keep-first\|keep-last\)\>" contained
syn region tidyString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained oneline
syn region tidyString start=+'+ skip=+\\\\\|\\'+ end=+'+ contained oneline
syn cluster tidyValue contains=tidyBoolean,tidyDoctype,tidyEncoding,tidyNewline,tidyNumber,tidyRepeat,tidyString
hi def link tidyAutoBoolean Boolean
hi def link tidyBoolean Boolean
hi def link tidyDoctype Constant
hi def link tidyEncoding Constant
hi def link tidyNewline Constant
hi def link tidyTags Constant
hi def link tidyNumber Number
hi def link tidyRepeat Constant
hi def link tidySorter Constant
hi def link tidyString String
syn match tidyOption "^accessibility-check" contained
syn match tidyOption "^add-xml-decl" contained
syn match tidyOption "^add-xml-pi" contained
syn match tidyOption "^add-xml-space" contained
syn match tidyOption "^alt-text" contained
syn match tidyOption "^anchor-as-name" contained
syn match tidyOption "^ascii-chars" contained
syn match tidyOption "^assume-xml-procins" contained
syn match tidyOption "^bare" contained
syn match tidyOption "^break-before-br" contained
syn match tidyOption "^char-encoding" contained
syn match tidyOption "^clean" contained
syn match tidyOption "^css-prefix" contained
syn match tidyOption "^decorate-inferred-ul" contained
syn match tidyOption "^doctype" contained
syn match tidyOption "^doctype-mode" contained
syn match tidyOption "^drop-empty-paras" contained
syn match tidyOption "^drop-font-tags" contained
syn match tidyOption "^drop-proprietary-attributes" contained
syn match tidyOption "^enclose-block-text" contained
syn match tidyOption "^enclose-text" contained
syn match tidyOption "^error-file" contained
syn match tidyOption "^escape-cdata" contained
syn match tidyOption "^fix-backslash" contained
syn match tidyOption "^fix-bad-comments" contained
syn match tidyOption "^fix-uri" contained
syn match tidyOption "^force-output" contained
syn match tidyOption "^gnu-emacs" contained
syn match tidyOption "^gnu-emacs-file" contained
syn match tidyOption "^hide-comments" contained
syn match tidyOption "^hide-endtags" contained
syn match tidyOption "^indent" contained
syn match tidyOption "^indent-attributes" contained
syn match tidyOption "^indent-cdata" contained
syn match tidyOption "^indent-spaces" contained
syn match tidyOption "^input-encoding" contained
syn match tidyOption "^input-xml" contained
syn match tidyOption "^join-classes" contained
syn match tidyOption "^join-styles" contained
syn match tidyOption "^keep-time" contained
syn match tidyOption "^language" contained
syn match tidyOption "^literal-attributes" contained
syn match tidyOption "^logical-emphasis" contained
syn match tidyOption "^lower-literals" contained
syn match tidyOption "^markup" contained
syn match tidyOption "^merge-divs" contained
syn match tidyOption "^merge-spans" contained
syn match tidyOption "^ncr" contained
syn match tidyOption "^newline" contained
syn match tidyOption "^numeric-entities" contained
syn match tidyOption "^output-bom" contained
syn match tidyOption "^output-encoding" contained
syn match tidyOption "^output-file" contained
syn match tidyOption "^output-html" contained
syn match tidyOption "^output-xhtml" contained
syn match tidyOption "^output-xml" contained
syn match tidyOption "^preserve-entities" contained
syn match tidyOption "^punctuation-wrap" contained
syn match tidyOption "^quiet" contained
syn match tidyOption "^quote-ampersand" contained
syn match tidyOption "^quote-marks" contained
syn match tidyOption "^quote-nbsp" contained
syn match tidyOption "^raw" contained
syn match tidyOption "^repeated-attributes" contained
syn match tidyOption "^replace-color" contained
syn match tidyOption "^show-body-only" contained
syn match tidyOption "^show-errors" contained
syn match tidyOption "^show-warnings" contained
syn match tidyOption "^slide-style" contained
syn match tidyOption "^sort-attributes" contained
syn match tidyOption "^split" contained
syn match tidyOption "^tab-size" contained
syn match tidyOption "^tidy-mark" contained
syn match tidyOption "^uppercase-attributes" contained
syn match tidyOption "^uppercase-tags" contained
syn match tidyOption "^word-2000" contained
syn match tidyOption "^wrap" contained
syn match tidyOption "^wrap-asp" contained
syn match tidyOption "^wrap-attributes" contained
syn match tidyOption "^wrap-jste" contained
syn match tidyOption "^wrap-php" contained
syn match tidyOption "^wrap-script-literals" contained
syn match tidyOption "^wrap-sections" contained
syn match tidyOption "^write-back" contained
syn match tidyOption "^vertical-space" contained
syn match tidyNewTagOption "^new-blocklevel-tags" contained
syn match tidyNewTagOption "^new-empty-tags" contained
syn match tidyNewTagOption "^new-inline-tags" contained
syn match tidyNewTagOption "^new-pre-tags" contained
hi def link tidyBoolean Boolean
hi def link tidyComment Comment
hi def link tidyDelimiter Special
hi def link tidyDoctype Constant
hi def link tidyEncoding Constant
hi def link tidyNewline Constant
hi def link tidyNewTagDelimiter Special
hi def link tidyNewTagOption Identifier
hi def link tidyNewTagValue Constant
hi def link tidyNumber Number
hi def link tidyOption Identifier
hi def link tidyRepeat Constant
hi def link tidyString String
hi def link tidyTodo Todo
hi def link tidyComment Comment
hi def link tidyTodo Todo
let b:current_syntax = "tidy"
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8

View File

@@ -1,9 +1,12 @@
" Vim syntax file
" Language: Vim 7.4 script
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Last Change: Apr 02, 2015
" Version: 7.4-33
" Automatically generated keyword lists: {{{1
" #############################################################################
" #############################################################################
" Note: Be careful when merging the upstream version of this file.
" Much of this is generated by scripts/genvimvim.lua (result is installed
" to: $VIMRUNTIME/syntax/vim/generated.vim)
" #############################################################################
" #############################################################################
" Quit when a syntax file was already loaded {{{2
if exists("b:current_syntax")
@@ -31,8 +34,8 @@ syn keyword vimOnlyOption contained nobiosk nobioskey noconsk noconskey nocp noc
" Invertible setting variants
syn keyword vimOnlyOption contained invbiosk invbioskey invconsk invconskey invcp invcompatible invguipty invmacatsui invsn invshortname invta invtextauto invtx invtextmode invtf invttyfast invtbi invttybuiltin invwiv invweirdinvert
" termcap codes (which can also be set) {{{2
syn keyword vimTermOption contained t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
syn keyword vimTermOption contained t_AF t_AL t_cd t_Ce t_cm t_cs
syn keyword vimTermOption contained t_8b t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RB t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_SR t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xn t_xs t_ZH t_ZR
syn keyword vimTermOption contained t_8f t_AF t_AL t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EI
syn match vimTermOption contained "t_%1"
syn match vimTermOption contained "t_#2"
syn match vimTermOption contained "t_#4"
@@ -53,11 +56,64 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean
syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
syn match vimHLGroup contained "Conceal"
syn keyword vimOnlyHLGroup contained VisualNOS
syn keyword nvimHLGroup contained EndOfBuffer TermCursor TermCursorNC
syn keyword nvimHLGroup contained EndOfBuffer Substitute TermCursor TermCursorNC QuickFixLine
"}}}2
syn case match
" Special Vim Highlighting (not automatic) {{{1
" Set up folding commands
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[aflmpPrt]'
if g:vimsyn_folding =~# 'a'
com! -nargs=* VimFolda <args> fold
else
com! -nargs=* VimFolda <args>
endif
if g:vimsyn_folding =~# 'f'
com! -nargs=* VimFoldf <args> fold
else
com! -nargs=* VimFoldf <args>
endif
if g:vimsyn_folding =~# 'l'
com! -nargs=* VimFoldl <args> fold
else
com! -nargs=* VimFoldl <args>
endif
if g:vimsyn_folding =~# 'm'
com! -nargs=* VimFoldm <args> fold
else
com! -nargs=* VimFoldm <args>
endif
if g:vimsyn_folding =~# 'p'
com! -nargs=* VimFoldp <args> fold
else
com! -nargs=* VimFoldp <args>
endif
if g:vimsyn_folding =~# 'P'
com! -nargs=* VimFoldP <args> fold
else
com! -nargs=* VimFoldP <args>
endif
if g:vimsyn_folding =~# 'r'
com! -nargs=* VimFoldr <args> fold
else
com! -nargs=* VimFoldr <args>
endif
if g:vimsyn_folding =~# 't'
com! -nargs=* VimFoldt <args> fold
else
com! -nargs=* VimFoldt <args>
endif
else
com! -nargs=* VimFolda <args>
com! -nargs=* VimFoldf <args>
com! -nargs=* VimFoldl <args>
com! -nargs=* VimFoldm <args>
com! -nargs=* VimFoldp <args>
com! -nargs=* VimFoldP <args>
com! -nargs=* VimFoldr <args>
com! -nargs=* VimFoldt <args>
endif
" commands not picked up by the generator (due to non-standard format)
syn keyword vimCommand contained py3
@@ -80,8 +136,8 @@ syn match vimNumber "\<0[xX]\x\+"
syn match vimNumber "\%(^\|[^a-zA-Z]\)\zs#\x\{6}"
" All vimCommands are contained by vimIsCommands. {{{2
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimCommand,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd,vimOnlyCommand
syn match vimIsCommand "\<\h\w*\>" contains=vimCommand,vimOnlyCommand
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd
syn match vimIsCommand "\<\h\w*\>" contains=vimCommand
syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>"
syn match vimVar "\<[bwglsav]:\h[a-zA-Z0-9#_]*\>"
syn match vimFBVar contained "\<[bwglsav]:\h[a-zA-Z0-9#_]*\>"
@@ -113,10 +169,10 @@ syn keyword vimFTOption contained detect indent off on plugin
" Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2
" ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking.
syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue
if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'a'
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a'
syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
else
syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
endif
syn match vimAugroup "aug\%[roup]!" contains=vimAugroupKey
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror")
@@ -130,7 +186,7 @@ syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperPa
syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile
syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup
syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror")
syn match vimOperError ")"
endif
@@ -141,7 +197,7 @@ syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimF
syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vimComment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimExecute,vimIf,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand,nvimUnmap,nvimMap
syn match vimFunction "\<fu\%[nction]!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody
if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'f'
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
syn region vimFuncBody contained fold start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList
else
syn region vimFuncBody contained start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList
@@ -224,10 +280,11 @@ syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+
syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation
syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation
syn cluster vimSubstList add=vimCollection
syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[:[:alpha:]]\@!" nextgroup=vimSubstPat
syn match vimSubst "s\%[ubstitute][:#[:alpha:]]\@!" nextgroup=vimSubstPat contained
syn match vimSubst "/\zss\%[ubstitute]\ze/" nextgroup=vimSubstPat
syn match vimSubst1 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat
syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\<s\%[ubstitute]\>\|\<sm\%[agic]\>\|\<sno\%[magic]\>\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat
syn match vimSubst "\%(^\|[^\\]\)\<s\%[ubstitute]\>[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained
syn match vimSubst "/\zs\<s\%[ubstitute]\>\ze/" nextgroup=vimSubstPat
syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
syn match vimSubst1 contained "\<s\%[ubstitute]\>" nextgroup=vimSubstPat
syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline
syn region vimCollection contained transparent start="\\\@<!\[" skip="\\\[" end="\]" contains=vimCollClass
@@ -267,7 +324,7 @@ syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1
syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)'
" Set command and associated set-options (vimOptions) with comment {{{2
syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod,vimTermOption,vimOnlyOption
syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod
syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]\|$"me=e-1 contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar oneline
syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar
syn match vimSetSep contained "[,:]" skipwhite nextgroup=vimCommand
@@ -341,8 +398,8 @@ syn case match
" User Function Highlighting {{{2
" (following Gautam Iyer's suggestion)
" ==========================
syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation
syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation
syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<return\>\|\<while\>"
" Errors And Warnings: {{{2
@@ -388,11 +445,16 @@ syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList
" Syntax: cluster {{{2
syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName
syn region vimClusterName contained matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError
syn region vimClusterName contained matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError
syn match vimGroupAdd contained "add=" nextgroup=vimGroupList
syn match vimGroupRem contained "remove=" nextgroup=vimGroupList
syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem
" Syntax: iskeyword {{{2
syn keyword vimSynType contained iskeyword skipwhite nextgroup=vimIskList
syn match vimIskList contained '\S\+' contains=vimIskSep
syn match vimIskSep contained ','
" Syntax: include {{{2
syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList
syn cluster vimFuncBodyList add=vimSynType
@@ -400,14 +462,14 @@ syn cluster vimFuncBodyList add=vimSynType
" Syntax: keyword {{{2
syn cluster vimSynKeyGroup contains=vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin
syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion
syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup
syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup
syn match vimSynKeyOpt contained "\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>"
syn cluster vimFuncBodyList add=vimSynType
" Syntax: match {{{2
syn cluster vimSynMtchGroup contains=vimMtchComment,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation
syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion
syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\k\+" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup
syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup
syn match vimSynMtchOpt contained "\<\(conceal\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>"
if has("conceal")
syn match vimSynMtchOpt contained "\<cchar=" nextgroup=vimSynMtchCchar
@@ -422,7 +484,7 @@ syn keyword vimSynType contained enable list manual off on reset
syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation
syn cluster vimSynRegGroup contains=vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp
syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion
syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup
syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup
syn match vimSynRegOpt contained "\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>"
syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat
syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup,vimOnlyHLGroup,nvimHLGroup
@@ -448,9 +510,9 @@ syn keyword vimSyncRegion contained region skipwhite nextgroup=vimSynReg
syn match vimSyncLinebreak contained "\<linebreaks=" skipwhite nextgroup=vimNumber
syn keyword vimSyncLinecont contained linecont skipwhite nextgroup=vimSynRegPat
syn match vimSyncLines contained "\(min\|max\)\=lines=" nextgroup=vimNumber
syn match vimSyncGroupName contained "\k\+" skipwhite nextgroup=vimSyncKey
syn match vimSyncGroupName contained "\h\w*" skipwhite nextgroup=vimSyncKey
syn match vimSyncKey contained "\<groupthere\|grouphere\>" skipwhite nextgroup=vimSyncGroup
syn match vimSyncGroup contained "\k\+" skipwhite nextgroup=vimSynRegPat,vimSyncNone
syn match vimSyncGroup contained "\h\w*" skipwhite nextgroup=vimSynRegPat,vimSyncNone
syn keyword vimSyncNone contained NONE
" Additional IsCommand, here by reasons of precedence {{{2
@@ -531,9 +593,14 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e
" Allows users to specify the type of embedded script highlighting
" they want: (perl/python/ruby/tcl support)
" g:vimsyn_embed == 0 : don't embed any scripts
" g:vimsyn_embed ~= 'P' : embed python (but only if vim supports it)
" g:vimsyn_embed =~# 'l' : embed lua (but only if vim supports it)
" g:vimsyn_embed =~# 'm' : embed mzscheme (but only if vim supports it)
" g:vimsyn_embed =~# 'p' : embed perl (but only if vim supports it)
" g:vimsyn_embed =~# 'P' : embed python (but only if vim supports it)
" g:vimsyn_embed =~# 'r' : embed ruby (but only if vim supports it)
" g:vimsyn_embed =~# 't' : embed tcl (but only if vim supports it)
if !exists("g:vimsyn_embed")
let g:vimsyn_embed= "P"
let g:vimsyn_embed= "lmpPr"
endif
" [-- lua --] {{{3
@@ -546,9 +613,16 @@ if !filereadable(s:luapath)
endif
endfor
endif
syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+
if (g:vimsyn_embed =~# 'l' && has("lua")) && filereadable(s:luapath)
unlet! b:current_syntax
exe "syn include @vimLuaScript ".s:luapath
VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript
VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript
syn cluster vimFuncBodyList add=vimLuaRegion
else
syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+
endif
unlet s:luapath
" [-- perl --] {{{3
@@ -561,9 +635,16 @@ if !filereadable(s:perlpath)
endif
endfor
endif
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+
if (g:vimsyn_embed =~# 'p' && has("perl")) && filereadable(s:perlpath)
unlet! b:current_syntax
exe "syn include @vimPerlScript ".s:perlpath
VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPerlScript
VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript
syn cluster vimFuncBodyList add=vimPerlRegion
else
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+
endif
unlet s:perlpath
" [-- ruby --] {{{3
@@ -576,9 +657,16 @@ if !filereadable(s:rubypath)
endif
endfor
endif
syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+
if (g:vimsyn_embed =~# 'r' && has("ruby")) && filereadable(s:rubypath)
unlet! b:current_syntax
exe "syn include @vimRubyScript ".s:rubypath
VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimRubyScript
syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript
syn cluster vimFuncBodyList add=vimRubyRegion
else
syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+
endif
unlet s:rubypath
" [-- python --] {{{3
@@ -591,16 +679,13 @@ if !filereadable(s:pythonpath)
endif
endfor
endif
if g:vimsyn_embed =~ 'P' && filereadable(s:pythonpath)
if g:vimsyn_embed =~# 'P' && (has("python") || has("python3")) && filereadable(s:pythonpath)
unlet! b:current_syntax
exe "syn include @vimPythonScript ".s:pythonpath
if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'P'
syn region vimPythonRegion fold matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
syn region vimPythonRegion fold matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
else
syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
endif
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
syn cluster vimFuncBodyList add=vimPythonRegion
else
syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
@@ -625,11 +710,17 @@ if s:trytcl
endif
endfor
endif
syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
if (g:vimsyn_embed =~# 't' && has("tcl")) && filereadable(s:tclpath)
unlet! b:current_syntax
exe "syn include @vimTclScript ".s:tclpath
VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript
VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript
syn cluster vimFuncBodyList add=vimTclScript
else
syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
endif
unlet s:tclpath
else
syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
@@ -646,9 +737,18 @@ if !filereadable(s:mzschemepath)
endif
endfor
endif
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+
if (g:vimsyn_embed =~# 'm' && has("mzscheme")) && filereadable(s:mzschemepath)
unlet! b:current_syntax
let iskKeep= &isk
exe "syn include @vimMzSchemeScript ".s:mzschemepath
let &isk= iskKeep
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript
syn cluster vimFuncBodyList add=vimMzSchemeRegion
else
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+
endif
unlet s:mzschemepath
" Synchronize (speed) {{{2
@@ -668,7 +768,6 @@ syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]"
" Highlighting Settings {{{2
" ====================
if !exists("g:vimsyn_noerror")
hi def link vimBehaveError vimError
hi def link vimCollClassErr vimError
@@ -685,14 +784,11 @@ if !exists("g:vimsyn_noerror")
hi def link vimSubstFlagErr vimError
hi def link vimSynCaseError vimError
hi def link vimBufnrWarn vimWarn
hi def link vimOnlyCommand vimError
hi def link vimTermOption vimError
hi def link vimOnlyOption vimError
hi def link vimOnlyHLGroup vimError
endif
hi def link vimAbb vimCommand
hi def link vimAddress vimMark
hi def link vimAugroupError vimError
hi def link vimAugroupKey vimCommand
hi def link vimAuHighlight vimHighlight
hi def link vimAutoCmdOpt vimOption
@@ -748,6 +844,7 @@ hi def link vimHLGroup vimGroup
hi def link nvimHLGroup vimHLGroup
hi def link vimHLMod PreProc
hi def link vimInsert vimString
hi def link vimIskSep Delimiter
hi def link vimKeyCode vimSpecFile
hi def link vimKeyword Statement
hi def link vimLet vimCommand
@@ -830,6 +927,7 @@ hi def link vimUserAttrbCmpltFunc Special
hi def link vimUserAttrbCmplt vimSpecial
hi def link vimUserAttrbKey vimOption
hi def link vimUserAttrb vimSpecial
hi def link vimUserAttrbError Error
hi def link vimUserCmdError Error
hi def link vimUserCommand vimCommand
hi def link vimUserFunc Normal
@@ -841,6 +939,14 @@ let b:current_syntax = "vim"
" ---------------------------------------------------------------------
" Cleanup: {{{1
delc VimFolda
delc VimFoldf
delc VimFoldl
delc VimFoldm
delc VimFoldp
delc VimFoldP
delc VimFoldr
delc VimFoldt
let &cpo = s:keepcpo
unlet s:keepcpo
" vim:ts=18 fdm=marker

View File

@@ -19,6 +19,12 @@ inoremap <C-U> <C-G>u<C-U>
" Switch syntax highlighting on
syntax on
" Also switch on highlighting the last used search pattern.
set hlsearch
" I like highlighting strings inside C comments.
let c_comment_strings=1
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'textwidth' set to 72,
" 'cindent' is on in C files, etc.

View File

@@ -1,11 +1,11 @@
#!/bin/sh
set -e
files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt"
data_files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt"
emoji_files="emoji-data.txt"
UNIDIR_DEFAULT=unicode
DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public/UNIDATA'
DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public'
if test x$1 = 'x--help' ; then
echo 'Usage:'
@@ -21,8 +21,16 @@ fi
UNIDIR=${1:-$UNIDIR_DEFAULT}
DOWNLOAD_URL_BASE=${2:-$DOWNLOAD_URL_BASE_DEFAULT}
for filename in $files ; do
curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/$filename"
for filename in $data_files ; do
curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/$filename"
(
cd "$UNIDIR"
git add $filename
)
done
for filename in $emoji_files ; do
curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/emoji/3.0/$filename"
(
cd "$UNIDIR"
git add $filename

329
scripts/gendispatch.lua Normal file
View File

@@ -0,0 +1,329 @@
lpeg = require('lpeg')
mpack = require('mpack')
-- lpeg grammar for building api metadata from a set of header files. It
-- ignores comments and preprocessor commands and parses a very small subset
-- of C prototypes with a limited set of types
P, R, S = lpeg.P, lpeg.R, lpeg.S
C, Ct, Cc, Cg = lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg
any = P(1) -- (consume one character)
letter = R('az', 'AZ') + S('_$')
alpha = letter + R('09')
nl = P('\r\n') + P('\n')
not_nl = any - nl
ws = S(' \t') + nl
fill = ws ^ 0
c_comment = P('//') * (not_nl ^ 0)
c_preproc = P('#') * (not_nl ^ 0)
typed_container =
(P('ArrayOf(') + P('DictionaryOf(')) * ((any - P(')')) ^ 1) * P(')')
c_id = (
typed_container +
(letter * (alpha ^ 0))
)
c_void = P('void')
c_param_type = (
((P('Error') * fill * P('*') * fill) * Cc('error')) +
(C(c_id) * (ws ^ 1))
)
c_type = (C(c_void) * (ws ^ 1)) + c_param_type
c_param = Ct(c_param_type * C(c_id))
c_param_list = c_param * (fill * (P(',') * fill * c_param) ^ 0)
c_params = Ct(c_void + c_param_list)
c_proto = Ct(
Cg(c_type, 'return_type') * Cg(c_id, 'name') *
fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') *
Cg(Cc(false), 'async') *
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
(fill * Cg((P('FUNC_API_NOEVAL') * Cc(true)), 'noeval') ^ -1) *
fill * P(';')
)
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
-- we need at least 4 arguments since the last two are output files
assert(#arg >= 3)
functions = {}
local nvimsrcdir = arg[1]
package.path = nvimsrcdir .. '/?.lua;' .. package.path
-- names of all headers relative to the source root (for inclusion in the
-- generated file)
headers = {}
-- output h file with generated dispatch functions
dispatch_outputf = arg[#arg-2]
-- output h file with packed metadata
funcs_metadata_outputf = arg[#arg-1]
-- output metadata mpack file, for use by other build scripts
mpack_outputf = arg[#arg]
-- set of function names, used to detect duplicates
function_names = {}
-- read each input file, parse and append to the api metadata
for i = 2, #arg - 3 do
local full_path = arg[i]
local parts = {}
for part in string.gmatch(full_path, '[^/]+') do
parts[#parts + 1] = part
end
headers[#headers + 1] = parts[#parts - 1]..'/'..parts[#parts]
local input = io.open(full_path, 'rb')
local tmp = grammar:match(input:read('*all'))
for i = 1, #tmp do
local fn = tmp[i]
if not fn.noexport then
functions[#functions + 1] = tmp[i]
function_names[fn.name] = true
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
-- this function should receive the channel id
fn.receives_channel_id = true
-- remove the parameter since it won't be passed by the api client
table.remove(fn.parameters, 1)
end
if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
-- function can fail if the last parameter type is 'Error'
fn.can_fail = true
-- remove the error parameter, msgpack has it's own special field
-- for specifying errors
fn.parameters[#fn.parameters] = nil
end
end
end
input:close()
end
local function shallowcopy(orig)
local copy = {}
for orig_key, orig_value in pairs(orig) do
copy[orig_key] = orig_value
end
return copy
end
local function startswith(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
-- Export functions under older deprecated names.
-- These will be removed eventually.
local deprecated_aliases = require("api.dispatch_deprecated")
for i,f in ipairs(shallowcopy(functions)) do
local ismethod = false
if startswith(f.name, "nvim_") then
-- TODO(bfredl) after 0.1.6 allow method definitions
-- to specify the since and deprecated_since field
f.since = 1
if startswith(f.name, "nvim_buf_") then
ismethod = true
elseif startswith(f.name, "nvim_win_") then
ismethod = true
elseif startswith(f.name, "nvim_tabpage_") then
ismethod = true
end
else
f.noeval = true
f.since = 0
f.deprecated_since = 1
end
f.method = ismethod
local newname = deprecated_aliases[f.name]
if newname ~= nil then
if function_names[newname] then
-- duplicate
print("Function "..f.name.." has deprecated alias\n"
..newname.." which has a separate implementation.\n"..
"Please remove it from src/nvim/api/dispatch_deprecated.lua")
os.exit(1)
end
local newf = shallowcopy(f)
newf.name = newname
if newname == "ui_try_resize" then
-- The return type was incorrectly set to Object in 0.1.5.
-- Keep it that way for clients that rely on this.
newf.return_type = "Object"
end
newf.impl_name = f.name
newf.noeval = true
newf.since = 0
newf.deprecated_since = 1
functions[#functions+1] = newf
end
end
-- don't expose internal attributes like "impl_name" in public metadata
exported_attributes = {'name', 'parameters', 'return_type', 'method',
'since', 'deprecated_since'}
exported_functions = {}
for _,f in ipairs(functions) do
local f_exported = {}
for _,attr in ipairs(exported_attributes) do
f_exported[attr] = f[attr]
end
exported_functions[#exported_functions+1] = f_exported
end
funcs_metadata_output = io.open(funcs_metadata_outputf, 'wb')
funcs_metadata_output:write([[
static const uint8_t funcs_metadata[] = {
]])
-- serialize the API metadata using msgpack and embed into the resulting
-- binary for easy querying by clients
packed_exported_functions = mpack.pack(exported_functions)
for i = 1, #packed_exported_functions do
funcs_metadata_output:write(string.byte(packed_exported_functions, i)..', ')
if i % 10 == 0 then
funcs_metadata_output:write('\n ')
end
end
funcs_metadata_output:write([[
};
]])
funcs_metadata_output:close()
-- start building the dispatch wrapper output
output = io.open(dispatch_outputf, 'wb')
local function real_type(type)
local rv = type
if typed_container:match(rv) then
if rv:match('Array') then
rv = 'Array'
else
rv = 'Dictionary'
end
end
return rv
end
-- start the handler functions. Visit each function metadata to build the
-- handler function with code generated for validating arguments and calling to
-- the real API.
for i = 1, #functions do
local fn = functions[i]
if fn.impl_name == nil then
local args = {}
output:write('Object handle_'..fn.name..'(uint64_t channel_id, Array args, Error *error)')
output:write('\n{')
output:write('\n Object ret = NIL;')
-- Declare/initialize variables that will hold converted arguments
for j = 1, #fn.parameters do
local param = fn.parameters[j]
local converted = 'arg_'..j
output:write('\n '..param[1]..' '..converted..';')
end
output:write('\n')
output:write('\n if (args.size != '..#fn.parameters..') {')
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
output:write('\n error->set = true;')
output:write('\n goto cleanup;')
output:write('\n }\n')
-- Validation/conversion for each argument
for j = 1, #fn.parameters do
local converted, convert_arg, param, arg
param = fn.parameters[j]
converted = 'arg_'..j
local rt = real_type(param[1])
if rt ~= 'Object' then
if rt:match('^Buffer$') or rt:match('^Window$') or rt:match('^Tabpage$') then
-- Buffer, Window, and Tabpage have a specific type, but are stored in integer
output:write('\n if (args.items['..(j - 1)..'].type == kObjectType'..rt..' && args.items['..(j - 1)..'].data.integer >= 0) {')
output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;')
else
output:write('\n if (args.items['..(j - 1)..'].type == kObjectType'..rt..') {')
output:write('\n '..converted..' = args.items['..(j - 1)..'].data.'..rt:lower()..';')
end
if rt:match('^Buffer$') or rt:match('^Window$') or rt:match('^Tabpage$') or rt:match('^Boolean$') then
-- accept nonnegative integers for Booleans, Buffers, Windows and Tabpages
output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeInteger && args.items['..(j - 1)..'].data.integer >= 0) {')
output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;')
end
output:write('\n } else {')
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong type for argument '..j..', expecting '..param[1]..'");')
output:write('\n error->set = true;')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
output:write('\n '..converted..' = args.items['..(j - 1)..'];\n')
end
args[#args + 1] = converted
end
-- function call
local call_args = table.concat(args, ', ')
output:write('\n ')
if fn.return_type ~= 'void' then
-- has a return value, prefix the call with a declaration
output:write(fn.return_type..' rv = ')
end
-- write the function name and the opening parenthesis
output:write(fn.name..'(')
if fn.receives_channel_id then
-- if the function receives the channel id, pass it as first argument
if #args > 0 or fn.can_fail then
output:write('channel_id, '..call_args)
else
output:write('channel_id')
end
else
output:write(call_args)
end
if fn.can_fail then
-- if the function can fail, also pass a pointer to the local error object
if #args > 0 then
output:write(', error);\n')
else
output:write('error);\n')
end
-- and check for the error
output:write('\n if (error->set) {')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
output:write(');\n')
end
if fn.return_type ~= 'void' then
output:write('\n ret = '..string.upper(real_type(fn.return_type))..'_OBJ(rv);')
end
output:write('\n\ncleanup:');
output:write('\n return ret;\n}\n\n');
end
end
-- Generate a function that initializes method names with handler functions
output:write([[
void msgpack_rpc_init_method_table(void)
{
methods = map_new(String, MsgpackRpcRequestHandler)();
]])
for i = 1, #functions do
local fn = functions[i]
output:write(' msgpack_rpc_add_method_handler('..
'(String) {.data = "'..fn.name..'", '..
'.size = sizeof("'..fn.name..'") - 1}, '..
'(MsgpackRpcRequestHandler) {.fn = handle_'.. (fn.impl_name or fn.name)..
', .async = '..tostring(fn.async)..'});\n')
end
output:write('\n}\n\n')
output:close()
mpack_output = io.open(mpack_outputf, 'wb')
mpack_output:write(mpack.pack(functions))
mpack_output:close()

66
scripts/geneval.lua Normal file
View File

@@ -0,0 +1,66 @@
mpack = require('mpack')
local nvimsrcdir = arg[1]
local autodir = arg[2]
local metadata_file = arg[3]
local funcs_file = arg[4]
if nvimsrcdir == '--help' then
print([[
Usage:
lua geneval.lua src/nvim build/src/nvim/auto
Will generate build/src/nvim/auto/funcs.generated.h with definition of functions
static const array.
]])
os.exit(0)
end
package.path = nvimsrcdir .. '/?.lua;' .. package.path
local funcsfname = autodir .. '/funcs.generated.h'
local gperfpipe = io.open(funcsfname .. '.gperf', 'wb')
local funcs = require('eval').funcs
local metadata = mpack.unpack(io.open(arg[3], 'rb'):read("*all"))
for i,fun in ipairs(metadata) do
if not fun.noeval then
funcs[fun.name] = {
args=#fun.parameters,
func='api_wrapper',
data='&handle_'..fun.name,
}
end
end
local funcsdata = io.open(funcs_file, 'w')
funcsdata:write(mpack.pack(funcs))
funcsdata:close()
gperfpipe:write([[
%language=ANSI-C
%global-table
%define initializer-suffix ,0,0,NULL,NULL
%define word-array-name functions
%define hash-function-name hash_internal_func_gperf
%define lookup-function-name find_internal_func_gperf
%omit-struct-type
%struct-type
VimLFuncDef;
%%
]])
for name, def in pairs(funcs) do
args = def.args or 0
if type(args) == 'number' then
args = {args, args}
elseif #args == 1 then
args[2] = 'MAX_FUNC_ARGS'
end
func = def.func or ('f_' .. name)
data = def.data or "NULL"
gperfpipe:write(('%s, %s, %s, &%s, (FunPtr)%s\n')
:format(name, args[1], args[2], func, data))
end
gperfpipe:close()

View File

@@ -12,19 +12,27 @@
-- 2 then interval applies only to first, third, fifth, … character in range.
-- Fourth value is number that should be added to the codepoint to yield
-- folded/lower/upper codepoint.
-- 4. emoji_width and emoji_all tables: sorted lists of non-overlapping closed
-- intervals of Emoji characters. emoji_width contains all the characters
-- which don't have ambiguous or double width, and emoji_all has all Emojis.
if arg[1] == '--help' then
print('Usage:')
print(' genunicodetables.lua UnicodeData.txt CaseFolding.txt ' ..
'EastAsianWidth.txt')
print(' unicode_tables.generated.h')
print(' genunicodetables.lua unicode/ unicode_tables.generated.h')
os.exit(0)
end
local unicodedata_fname = arg[1]
local casefolding_fname = arg[2]
local eastasianwidth_fname = arg[3]
local basedir = arg[1]
local pathsep = package.config:sub(1, 1)
local get_path = function(fname)
return basedir .. pathsep .. fname
end
local utf_tables_fname = arg[4]
local unicodedata_fname = get_path('UnicodeData.txt')
local casefolding_fname = get_path('CaseFolding.txt')
local eastasianwidth_fname = get_path('EastAsianWidth.txt')
local emoji_fname = get_path('emoji-data.txt')
local utf_tables_fname = arg[2]
local split_on_semicolons = function(s)
local ret = {}
@@ -79,6 +87,10 @@ local parse_width_props = function(eaw_fp)
return fp_lines_to_lists(eaw_fp, 2, true)
end
local parse_emoji_props = function(emoji_fp)
return fp_lines_to_lists(emoji_fp, 2, true)
end
local make_range = function(start, end_, step, add)
if step and add then
return (' {0x%x, 0x%x, %d, %d},\n'):format(
@@ -168,6 +180,7 @@ local build_width_table = function(ut_fp, dataprops, widthprops, widths,
local start = -1
local end_ = -1
local dataidx = 1
local ret = {}
for _, p in ipairs(widthprops) do
if widths[p[2]:sub(1, 1)] then
local rng_start, rng_end = p[1]:find('%.%.')
@@ -200,6 +213,7 @@ local build_width_table = function(ut_fp, dataprops, widthprops, widths,
else
if start >= 0 then
ut_fp:write(make_range(start, end_))
table.insert(ret, {start, end_})
end
start = n
end
@@ -209,6 +223,72 @@ local build_width_table = function(ut_fp, dataprops, widthprops, widths,
end
if start >= 0 then
ut_fp:write(make_range(start, end_))
table.insert(ret, {start, end_})
end
ut_fp:write('};\n')
return ret
end
local build_emoji_table = function(ut_fp, emojiprops, doublewidth, ambiwidth)
local emojiwidth = {}
local emoji = {}
for _, p in ipairs(emojiprops) do
if p[2]:match('Emoji%s+#') then
local rng_start, rng_end = p[1]:find('%.%.')
if rng_start then
n = tonumber(p[1]:sub(1, rng_start - 1), 16)
n_last = tonumber(p[1]:sub(rng_end + 1), 16)
else
n = tonumber(p[1], 16)
n_last = n
end
if #emoji > 0 and n - 1 == emoji[#emoji][2] then
emoji[#emoji][2] = n_last
else
table.insert(emoji, { n, n_last })
end
-- Characters below 1F000 may be considered single width traditionally,
-- making them double width causes problems.
if n >= 0x1f000 then
-- exclude characters that are in the ambiguous/doublewidth table
for _, ambi in ipairs(ambiwidth) do
if n >= ambi[1] and n <= ambi[2] then
n = ambi[2] + 1
end
if n_last >= ambi[1] and n_last <= ambi[2] then
n_last = ambi[1] - 1
end
end
for _, double in ipairs(doublewidth) do
if n >= double[1] and n <= double[2] then
n = double[2] + 1
end
if n_last >= double[1] and n_last <= double[2] then
n_last = double[1] - 1
end
end
if n <= n_last then
if #emojiwidth > 0 and n - 1 == emojiwidth[#emojiwidth][2] then
emojiwidth[#emojiwidth][2] = n_last
else
table.insert(emojiwidth, { n, n_last })
end
end
end
end
end
ut_fp:write('static const struct interval emoji_all[] = {\n')
for _, p in ipairs(emoji) do
ut_fp:write(make_range(p[1], p[2]))
end
ut_fp:write('};\n')
ut_fp:write('static const struct interval emoji_width[] = {\n')
for _, p in ipairs(emojiwidth) do
ut_fp:write(make_range(p[1], p[2]))
end
ut_fp:write('};\n')
end
@@ -233,7 +313,15 @@ local eaw_fp = io.open(eastasianwidth_fname, 'r')
local widthprops = parse_width_props(eaw_fp)
eaw_fp:close()
build_width_table(ut_fp, dataprops, widthprops, {W=true, F=true}, 'doublewidth')
build_width_table(ut_fp, dataprops, widthprops, {A=true}, 'ambiguous')
local doublewidth = build_width_table(ut_fp, dataprops, widthprops,
{W=true, F=true}, 'doublewidth')
local ambiwidth = build_width_table(ut_fp, dataprops, widthprops,
{A=true}, 'ambiguous')
local emoji_fp = io.open(emoji_fname, 'r')
local emojiprops = parse_emoji_props(emoji_fp)
emoji_fp:close()
build_emoji_table(ut_fp, emojiprops, doublewidth, ambiwidth)
ut_fp:close()

View File

@@ -1,10 +1,13 @@
mpack = require('mpack')
if arg[1] == '--help' then
print('Usage: genoptions.lua src/nvim runtime/syntax/vim/generated.vim')
print('Usage: lua genvimvim.lua src/nvim runtime/syntax/vim/generated.vim')
os.exit(0)
end
local nvimsrcdir = arg[1]
local syntax_file = arg[2]
local funcs_file = arg[3]
package.path = nvimsrcdir .. '/?.lua;' .. package.path
@@ -111,28 +114,16 @@ end
w('\n\nsyn case match')
local vimfun_start = 'syn keyword vimFuncName contained '
w('\n\n' .. vimfun_start)
eval_fd = io.open(nvimsrcdir .. '/eval.c', 'r')
funcs = mpack.unpack(io.open(funcs_file):read("*all"))
local started = 0
for line in eval_fd:lines() do
if line == '} functions[] =' then
started = 1
elseif started == 1 then
assert (line == '{')
started = 2
elseif started == 2 then
if line == '};' then
break
end
local func_name = line:match('^ { "([%w_]+)",')
if func_name then
if lld.line_length > 850 then
w('\n' .. vimfun_start)
end
w(' ' .. func_name)
for name, def in pairs(funcs) do
if name then
if lld.line_length > 850 then
w('\n' .. vimfun_start)
end
w(' ' .. name)
end
end
eval_fd:close()
w('\n')
syn_fd:close()

View File

@@ -19,7 +19,7 @@ is_merge_commit() {
git log $1^2 >/dev/null 2>&1 && return 0 || return 1
}
for commit in $(git log --format='%H' --first-parent --since $__SINCE); do
for commit in $(git log --format='%H' --first-parent "$__SINCE"..HEAD); do
if is_merge_commit ${commit} ; then
if [ -z "$__INVMATCH" ] || ! git log --oneline ${commit}^1..${commit}^2 \
| grep -E "$__INVMATCH" >/dev/null 2>&1 ; then

View File

@@ -1,313 +0,0 @@
lpeg = require('lpeg')
mpack = require('mpack')
-- lpeg grammar for building api metadata from a set of header files. It
-- ignores comments and preprocessor commands and parses a very small subset
-- of C prototypes with a limited set of types
P, R, S = lpeg.P, lpeg.R, lpeg.S
C, Ct, Cc, Cg = lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg
any = P(1) -- (consume one character)
letter = R('az', 'AZ') + S('_$')
alpha = letter + R('09')
nl = P('\r\n') + P('\n')
not_nl = any - nl
ws = S(' \t') + nl
fill = ws ^ 0
c_comment = P('//') * (not_nl ^ 0)
c_preproc = P('#') * (not_nl ^ 0)
typed_container =
(P('ArrayOf(') + P('DictionaryOf(')) * ((any - P(')')) ^ 1) * P(')')
c_id = (
typed_container +
(letter * (alpha ^ 0))
)
c_void = P('void')
c_param_type = (
((P('Error') * fill * P('*') * fill) * Cc('error')) +
(C(c_id) * (ws ^ 1))
)
c_type = (C(c_void) * (ws ^ 1)) + c_param_type
c_param = Ct(c_param_type * C(c_id))
c_param_list = c_param * (fill * (P(',') * fill * c_param) ^ 0)
c_params = Ct(c_void + c_param_list)
c_proto = Ct(
Cg(c_type, 'return_type') * Cg(c_id, 'name') *
fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') *
Cg(Cc(false), 'async') *
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
fill * P(';')
)
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
-- we need at least 2 arguments since the last one is the output file
assert(#arg >= 1)
functions = {}
-- names of all headers relative to the source root (for inclusion in the
-- generated file)
headers = {}
-- output file(dispatch function + metadata serialized with msgpack)
outputf = arg[#arg]
-- read each input file, parse and append to the api metadata
for i = 1, #arg - 1 do
local full_path = arg[i]
local parts = {}
for part in string.gmatch(full_path, '[^/]+') do
parts[#parts + 1] = part
end
headers[#headers + 1] = parts[#parts - 1]..'/'..parts[#parts]
local input = io.open(full_path, 'rb')
local tmp = grammar:match(input:read('*all'))
for i = 1, #tmp do
local fn = tmp[i]
if not fn.noexport then
functions[#functions + 1] = tmp[i]
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
-- this function should receive the channel id
fn.receives_channel_id = true
-- remove the parameter since it won't be passed by the api client
table.remove(fn.parameters, 1)
end
if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
-- function can fail if the last parameter type is 'Error'
fn.can_fail = true
-- remove the error parameter, msgpack has it's own special field
-- for specifying errors
fn.parameters[#fn.parameters] = nil
end
end
end
input:close()
end
-- start building the output
output = io.open(outputf, 'wb')
output:write([[
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <assert.h>
#include <msgpack.h>
#include "nvim/map.h"
#include "nvim/log.h"
#include "nvim/vim.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/msgpack_rpc/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/private/defs.h"
]])
for i = 1, #headers do
if headers[i]:sub(-12) ~= '.generated.h' then
output:write('\n#include "nvim/'..headers[i]..'"')
end
end
output:write([[
static const uint8_t msgpack_metadata[] = {
]])
-- serialize the API metadata using msgpack and embed into the resulting
-- binary for easy querying by clients
packed = mpack.pack(functions)
for i = 1, #packed do
output:write(string.byte(packed, i)..', ')
if i % 10 == 0 then
output:write('\n ')
end
end
output:write([[
};
void msgpack_rpc_init_function_metadata(Dictionary *metadata)
{
msgpack_unpacked unpacked;
msgpack_unpacked_init(&unpacked);
if (msgpack_unpack_next(&unpacked,
(const char *)msgpack_metadata,
sizeof(msgpack_metadata),
NULL) != MSGPACK_UNPACK_SUCCESS) {
abort();
}
Object functions;
msgpack_rpc_to_object(&unpacked.data, &functions);
msgpack_unpacked_destroy(&unpacked);
PUT(*metadata, "functions", functions);
}
]])
local function real_type(type)
local rv = type
if typed_container:match(rv) then
if rv:match('Array') then
rv = 'Array'
else
rv = 'Dictionary'
end
end
return rv
end
-- start the handler functions. Visit each function metadata to build the
-- handler function with code generated for validating arguments and calling to
-- the real API.
for i = 1, #functions do
local fn = functions[i]
local args = {}
output:write('static Object handle_'..fn.name..'(uint64_t channel_id, uint64_t request_id, Array args, Error *error)')
output:write('\n{')
output:write('\n Object ret = NIL;')
-- Declare/initialize variables that will hold converted arguments
for j = 1, #fn.parameters do
local param = fn.parameters[j]
local converted = 'arg_'..j
output:write('\n '..param[1]..' '..converted..' api_init_'..string.lower(real_type(param[1]))..';')
end
output:write('\n')
output:write('\n if (args.size != '..#fn.parameters..') {')
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
output:write('\n error->set = true;')
output:write('\n goto cleanup;')
output:write('\n }\n')
-- Validation/conversion for each argument
for j = 1, #fn.parameters do
local converted, convert_arg, param, arg
param = fn.parameters[j]
converted = 'arg_'..j
local rt = real_type(param[1])
if rt ~= 'Object' then
output:write('\n if (args.items['..(j - 1)..'].type == kObjectType'..rt..') {')
output:write('\n '..converted..' = args.items['..(j - 1)..'].data.'..rt:lower()..';')
if rt:match('^Buffer$') or rt:match('^Window$') or rt:match('^Tabpage$') or rt:match('^Boolean$') then
-- accept positive integers for Buffers, Windows and Tabpages
output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeInteger && args.items['..(j - 1)..'].data.integer > 0) {')
output:write('\n '..converted..' = (unsigned)args.items['..(j - 1)..'].data.integer;')
end
output:write('\n } else {')
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong type for argument '..j..', expecting '..param[1]..'");')
output:write('\n error->set = true;')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
output:write('\n '..converted..' = args.items['..(j - 1)..'];\n')
end
args[#args + 1] = converted
end
-- function call
local call_args = table.concat(args, ', ')
output:write('\n ')
if fn.return_type ~= 'void' then
-- has a return value, prefix the call with a declaration
output:write(fn.return_type..' rv = ')
end
-- write the function name and the opening parenthesis
output:write(fn.name..'(')
if fn.receives_channel_id then
-- if the function receives the channel id, pass it as first argument
if #args > 0 or fn.can_fail then
output:write('channel_id, '..call_args)
else
output:write('channel_id')
end
else
output:write(call_args)
end
if fn.can_fail then
-- if the function can fail, also pass a pointer to the local error object
if #args > 0 then
output:write(', error);\n')
else
output:write('error);\n')
end
-- and check for the error
output:write('\n if (error->set) {')
output:write('\n goto cleanup;')
output:write('\n }\n')
else
output:write(');\n')
end
if fn.return_type ~= 'void' then
output:write('\n ret = '..string.upper(real_type(fn.return_type))..'_OBJ(rv);')
end
-- Now generate the cleanup label for freeing memory allocated for the
-- arguments
output:write('\n\ncleanup:');
for j = 1, #fn.parameters do
local param = fn.parameters[j]
output:write('\n api_free_'..string.lower(real_type(param[1]))..'(arg_'..j..');')
end
output:write('\n return ret;\n}\n\n');
end
-- Generate a function that initializes method names with handler functions
output:write([[
static Map(String, MsgpackRpcRequestHandler) *methods = NULL;
void msgpack_rpc_add_method_handler(String method, MsgpackRpcRequestHandler handler)
{
map_put(String, MsgpackRpcRequestHandler)(methods, method, handler);
}
void msgpack_rpc_init_method_table(void)
{
methods = map_new(String, MsgpackRpcRequestHandler)();
]])
-- Keep track of the maximum method name length in order to avoid walking
-- strings longer than that when searching for a method handler
local max_fname_len = 0
for i = 1, #functions do
local fn = functions[i]
output:write(' msgpack_rpc_add_method_handler('..
'(String) {.data = "'..fn.name..'", '..
'.size = sizeof("'..fn.name..'") - 1}, '..
'(MsgpackRpcRequestHandler) {.fn = handle_'.. fn.name..
', .async = '..tostring(fn.async)..'});\n')
if #fn.name > max_fname_len then
max_fname_len = #fn.name
end
end
output:write('\n}\n\n')
output:write([[
MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
size_t name_len)
{
String m = {
.data=(char *)name,
.size=MIN(name_len, ]]..max_fname_len..[[)
};
MsgpackRpcRequestHandler rv =
map_get(String, MsgpackRpcRequestHandler)(methods, m);
if (!rv.fn) {
rv.fn = msgpack_rpc_handle_missing_method;
}
return rv;
}
]])
output:close()

View File

@@ -1,10 +1,11 @@
#!/bin/sh
#!/usr/bin/env bash
# Performs steps to tag a release.
#
# Steps:
# Create the "release" commit:
# - CMakeLists.txt: Unset NVIM_VERSION_PRERELEASE
# - CMakeLists.txt: Unset NVIM_API_PRERELEASE
# - Tag the commit.
# Create the "version bump" commit:
# - CMakeLists.txt: Set NVIM_VERSION_PRERELEASE to "-dev"
@@ -17,42 +18,48 @@ set -e
set -u
set -o pipefail
__sed=$( [ "$(uname)" = Darwin ] && echo 'sed -E' || echo 'sed -r' )
cd "$(git rev-parse --show-toplevel)"
__LAST_TAG=$(git describe --abbrev=0)
[ -z "$__LAST_TAG" ] && { echo 'ERROR: no tag found'; exit 1; }
__VERSION_MAJOR=$(grep 'set(NVIM_VERSION_MAJOR' CMakeLists.txt\
|sed -r 's/.*NVIM_VERSION_MAJOR ([[:digit:]]).*/\1/')
|$__sed 's/.*NVIM_VERSION_MAJOR ([[:digit:]]).*/\1/')
__VERSION_MINOR=$(grep 'set(NVIM_VERSION_MINOR' CMakeLists.txt\
|sed -r 's/.*NVIM_VERSION_MINOR ([[:digit:]]).*/\1/')
|$__sed 's/.*NVIM_VERSION_MINOR ([[:digit:]]).*/\1/')
__VERSION_PATCH=$(grep 'set(NVIM_VERSION_PATCH' CMakeLists.txt\
|sed -r 's/.*NVIM_VERSION_PATCH ([[:digit:]]).*/\1/')
|$__sed 's/.*NVIM_VERSION_PATCH ([[:digit:]]).*/\1/')
__VERSION="${__VERSION_MAJOR}.${__VERSION_MINOR}.${__VERSION_PATCH}"
{ [ -z "$__VERSION_MAJOR" ] || [ -z "$__VERSION_MINOR" ] || [ -z "$__VERSION_PATCH" ]; } \
&& { echo "ERROR: version parse failed: '${__VERSION}'"; exit 1; }
__RELEASE_MSG="NVIM v${__VERSION}
Features:
FEATURES:
Fixes:
FIXES:
Changes:
CHANGES:
"
__BUMP_MSG="version bump"
echo "Most recent tag: ${__LAST_TAG}"
echo "Release version: ${__VERSION}"
sed -i -r 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
$__sed -i.bk 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
$__sed -i.bk 's/(NVIM_API_PRERELEASE) true/\1 false/' CMakeLists.txt
echo "Building changelog since ${__LAST_TAG}..."
__CHANGELOG="$(./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:\S')"
git add CMakeLists.txt
git commit --edit -m "${__RELEASE_MSG} ${__CHANGELOG}"
git tag -a v"${__VERSION}" -m "NVIM v${__VERSION}"
git tag --sign -a v"${__VERSION}" -m "NVIM v${__VERSION}"
$__sed -i.bk 's/(NVIM_VERSION_PRERELEASE) ""/\1 "-dev"/' CMakeLists.txt
$__sed -i.bk 's/set\((NVIM_VERSION_PATCH) [[:digit:]]/set(\1 ?/' CMakeLists.txt
nvim +'/NVIM_VERSION' +10new +'exe "norm! iUpdate version numbers!!!\<CR>"' \
+'norm! 10.' CMakeLists.txt
sed -i -r 's/(NVIM_VERSION_PRERELEASE) ""/\1 "-dev"/' CMakeLists.txt
nvim -c '/NVIM_VERSION' -c 'echo "Update version numbers"' CMakeLists.txt
git add CMakeLists.txt
git commit -m "$__BUMP_MSG"

View File

@@ -2,12 +2,11 @@
set -e
set -u
set -o pipefail
# Use privileged mode, which e.g. skips using CDPATH.
set -p
readonly NEOVIM_SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
readonly VIM_SOURCE_DIR_DEFAULT="${NEOVIM_SOURCE_DIR}/.vim-src"
readonly NVIM_SOURCE_DIR="${NVIM_SOURCE_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
readonly VIM_SOURCE_DIR_DEFAULT="${NVIM_SOURCE_DIR}/.vim-src"
readonly VIM_SOURCE_DIR="${VIM_SOURCE_DIR:-${VIM_SOURCE_DIR_DEFAULT}}"
readonly BASENAME="$(basename "${0}")"
readonly BRANCH_PREFIX="vim-"
@@ -124,6 +123,36 @@ assign_commit_details() {
patch_file="vim-${vim_version}.patch"
}
# Patch surgery
preprocess_patch() {
local file="$1"
local nvim="nvim -u NORC -i NONE --headless"
# Remove *.proto, Make*, gui_*, some if_*
local na_src='proto\|Make*\|gui_*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%('${na_src}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
# Remove channel.txt, netbeans.txt, os_*.txt, todo.txt, version*.txt, tags
local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|todo\.txt\|version\d\.txt\|tags'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\%('${na_doc}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
# Remove some testdir/Make_*.mak files
local na_src_testdir='Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\%('${na_src_testdir}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
# Remove some *.po files. #5622
local na_po='sjiscorr.c\|ja.sjis.po\|ko.po\|pl.cp1250.po\|pl.po\|ru.cp1251.po\|uk.cp1251.po\|zh_CN.cp936.po\|zh_CN.po\|zh_TW.po'
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\%('${na_po}'\)@norm! d/\v(^diff)|%$
' +w +q "$file"
# Rename src/ paths to src/nvim/
LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' \
"$file" > "$file".tmp && mv "$file".tmp "$file"
# Rename path to matchit plugin.
LC_ALL=C sed -e 's@\( [ab]/runtime\)/pack/dist/opt/matchit/\(plugin/matchit.vim\)@\1/\2@g' \
"$file" > "$file".tmp && mv "$file".tmp "$file"
}
@@ -133,17 +162,13 @@ get_vim_patch() {
assign_commit_details "${1}"
echo
git log -1 "${vim_commit}" -- >/dev/null 2>&1 || {
>&2 echo "✘ Couldn't find Vim revision '${vim_commit}'."
# Patch surgery: preprocess the patch.
# - transform src/ paths to src/nvim/
local vim_full
vim_full="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}" \
| LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g')"
local neovim_branch="${BRANCH_PREFIX}${vim_version}"
exit 3
}
echo "✔ Found Vim revision '${vim_commit}'."
cd "${NEOVIM_SOURCE_DIR}"
local patch_content
patch_content="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}")"
local nvim_branch="${BRANCH_PREFIX}${vim_version}"
@@ -153,51 +178,48 @@ get_vim_patch() {
local checked_out_branch
checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
echo
echo "Fetching '${git_remote}/master'."
if [[ "${checked_out_branch}" == ${BRANCH_PREFIX}* ]]; then
echo "✔ Current branch '${checked_out_branch}' seems to be a vim-patch"
echo " branch; not creating a new branch."
else
printf "\nFetching '${git_remote}/master'.\n"
output="$(git fetch "${git_remote}" master 2>&1)" &&
echo "Creating new branch '${neovim_branch}' based on '${git_remote}/master'."
cd "${NEOVIM_SOURCE_DIR}"
output="$(git checkout -b "${neovim_branch}" "${git_remote}/master" 2>&1)" &&
echo "${output}" ||
(echo "${output}"; false)
echo
echo "Creating new branch '${nvim_branch}' based on '${git_remote}/master'."
cd "${NVIM_SOURCE_DIR}"
output="$(git checkout -b "${nvim_branch}" "${git_remote}/master" 2>&1)" &&
echo
echo "Creating empty commit with correct commit message."
echo "${output}" ||
(echo "${output}"; false)
fi
printf "\nCreating empty commit with correct commit message.\n"
echo
echo "Creating files."
echo "${vim_full}" > "${NEOVIM_SOURCE_DIR}/${patch_file}"
echo "✔ Saved full commit details to '${NEOVIM_SOURCE_DIR}/${patch_file}'."
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
echo "${output}" ||
(echo "${output}"; false)
echo
echo "Instructions:"
echo
echo " Proceed to port the patch."
echo " You might want to try 'patch -p1 < ${patch_file}' first."
echo
echo " If the patch contains a new test, consider porting it to Lua."
echo " You might want to try 'scripts/legacy2luatest.pl'."
echo
echo " Stage your changes ('git add ...') and use 'git commit --amend' to commit."
echo
echo " To port additional patches related to ${vim_version} and add them to the current"
echo " branch, call '${BASENAME} -p' again. Please use this only if it wouldn't make"
echo " sense to send in each patch individually, as it will increase the size of the"
echo " pull request and make it harder to review."
echo
echo " When you are finished, use '${BASENAME} -s' to submit a pull request."
echo
echo " See https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim"
echo " for more information."
printf "Creating patch...\n"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
printf "Pre-processing patch...\n"
preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}"
printf "✔ Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n"
printf "\nInstructions:
Proceed to port the patch. This may help:
patch -p1 < ${patch_file}
Stage your changes ('git add ...') and use 'git commit --amend' to commit.
To port additional patches related to ${vim_version} and add them to the
current branch, call '${BASENAME} -p' again.
* Do this only for _related_ patches (otherwise it increases the
size of the pull request, making it harder to review)
When you're done, try '${BASENAME} -s' to create the pull request.
See the wiki for more information:
* https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim
@@ -223,7 +245,7 @@ submit_pr() {
push_first=0
submit_fn="git_hub_pr"
else
cd "${NEOVIM_SOURCE_DIR}"
>&2 echo "${BASENAME}: 'hub' or 'git-hub' not found in PATH or not executable."
exit 1
fi
@@ -263,11 +285,11 @@ submit_pr() {
(echo "${output}"; false)
echo
if [[ ! -f "${NEOVIM_SOURCE_DIR}/${patch_file}" ]]; then
echo "Cleaning up files."
local patch_file
for patch_file in "${patches[@]}"; do
rm -- "${NEOVIM_SOURCE_DIR}/${patch_file}"
echo "✔ Removed '${NEOVIM_SOURCE_DIR}/${patch_file}'."
patch_file="vim-${patch_file}.patch"
if [[ ! -f "${NVIM_SOURCE_DIR}/${patch_file}" ]]; then
continue
fi
rm -- "${NVIM_SOURCE_DIR}/${patch_file}"
@@ -289,7 +311,7 @@ list_vim_patches() {
local is_missing
local vim_tag
# This fails for untagged commits (e.g., runtime file updates) so mask the return status
is_missing="$(sed -n '/static int included_patches/,/}/p' "${NEOVIM_SOURCE_DIR}/src/nvim/version.c" |
vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" || true
if [[ -n "${vim_tag}" ]]; then
local patch_number="${vim_tag:5}" # Remove prefix like "v7.4."
# Tagged Vim patch, check version.c:
@@ -297,7 +319,7 @@ list_vim_patches() {
grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")"
vim_commit="${vim_tag#v}"
if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then
is_missing="$(cd "${NEOVIM_SOURCE_DIR}" &&
vim_commit="${vim_commit} (+runtime)"
fi
else
# Untagged Vim patch (e.g. runtime updates), check the Neovim git log:
@@ -321,14 +343,14 @@ list_vim_patches() {
echo " '${BASENAME} -p 1e8ebf870720e7b671f98f22d653009826304c4f'"
echo
echo " NOTE: Please port the _oldest_ patch if you possibly can."
local neovim_commit_url="${1}"
local neovim_patch_url="${neovim_commit_url}.patch"
echo " Out-of-order patches increase the possibility of bugs."
}
review_commit() {
local neovim_patch
neovim_patch="$(curl -Ssf "${neovim_patch_url}")"
local nvim_commit_url="${1}"
local nvim_patch_url="${nvim_commit_url}.patch"
vim_version="$(head -n 4 <<< "${neovim_patch}" | sed -n "s/${git_patch_prefix}vim-patch:\([a-z0-9.]*\)$/\1/p")"
local git_patch_prefix='Subject: \[PATCH\] '
local nvim_patch
nvim_patch="$(curl -Ssf "${nvim_patch_url}")"
local vim_version
@@ -349,7 +371,7 @@ review_commit() {
local vim_patch_url="${vim_commit_url}.patch"
local expected_commit_message
commit_message="$(tail -n +4 <<< "${neovim_patch}" | head -n "${message_length}")"
expected_commit_message="$(commit_message)"
local message_length
message_length="$(wc -l <<< "${expected_commit_message}")"
local commit_message
@@ -362,18 +384,18 @@ review_commit() {
echo "${expected_commit_message}"
echo " Actual:"
echo "${commit_message#${git_patch_prefix}}"
echo "${neovim_patch}" > "${NEOVIM_SOURCE_DIR}/n${patch_file}"
echo "✔ Saved pull request diff to '${NEOVIM_SOURCE_DIR}/n${patch_file}'."
CREATED_FILES+=("${NEOVIM_SOURCE_DIR}/n${patch_file}")
fi
echo
echo "Creating files."
curl -Ssfo "${NEOVIM_SOURCE_DIR}/${patch_file}" "${vim_patch_url}"
echo "✔ Saved Vim diff to '${NEOVIM_SOURCE_DIR}/${patch_file}'."
CREATED_FILES+=("${NEOVIM_SOURCE_DIR}/${patch_file}")
echo "${nvim_patch}" > "${NVIM_SOURCE_DIR}/n${patch_file}"
echo "✔ Saved pull request diff to '${NVIM_SOURCE_DIR}/n${patch_file}'."
CREATED_FILES+=("${NVIM_SOURCE_DIR}/n${patch_file}")
curl -Ssfo "${NVIM_SOURCE_DIR}/${patch_file}" "${vim_patch_url}"
echo "✔ Saved Vim diff to '${NVIM_SOURCE_DIR}/${patch_file}'."
nvim -c "cd ${NEOVIM_SOURCE_DIR}" \
-O "${NEOVIM_SOURCE_DIR}/${patch_file}" "${NEOVIM_SOURCE_DIR}/n${patch_file}"
CREATED_FILES+=("${NVIM_SOURCE_DIR}/${patch_file}")
echo
echo "Launching nvim."
nvim -c "cd ${NVIM_SOURCE_DIR}" \

View File

@@ -1,3 +1,3 @@
# libuv queue.h pointer arithmetic is not accepted by asan
fun:queue_node_data
# multiqueue.h pointer arithmetic is not accepted by asan
fun:multiqueue_node_data
fun:dictwatcher_node_data

View File

@@ -11,31 +11,37 @@ endif()
endif()
set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/nvim/auto)
set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/msgpack-gen.lua)
set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendispatch.lua)
file(GLOB API_HEADERS api/*.h)
file(GLOB MSGPACK_RPC_HEADERS msgpack_rpc/*.h)
set(MSGPACK_DISPATCH ${GENERATED_DIR}/msgpack_dispatch.c)
set(API_METADATA ${PROJECT_BINARY_DIR}/api_metadata.mpack)
set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
set(HEADER_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendeclarations.lua)
set(GENERATED_INCLUDES_DIR ${PROJECT_BINARY_DIR}/include)
set(GENERATED_API_DISPATCH ${GENERATED_DIR}/api/private/dispatch_wrappers.generated.h)
set(GENERATED_FUNCS_METADATA ${GENERATED_DIR}/api/private/funcs_metadata.generated.h)
set(GENERATED_EX_CMDS_ENUM ${GENERATED_INCLUDES_DIR}/ex_cmds_enum.generated.h)
set(GENERATED_EX_CMDS_DEFS ${GENERATED_DIR}/ex_cmds_defs.generated.h)
set(GENERATED_FUNCS_HASH_INPUT ${GENERATED_DIR}/funcs.generated.h.gperf)
set(GENERATED_FUNCS ${GENERATED_DIR}/funcs.generated.h)
set(GENERATED_EVENTS_ENUM ${GENERATED_INCLUDES_DIR}/auevents_enum.generated.h)
set(GENERATED_EVENTS_NAMES_MAP ${GENERATED_DIR}/auevents_name_map.generated.h)
set(GENERATED_OPTIONS ${GENERATED_DIR}/options.generated.h)
set(EX_CMDS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genex_cmds.lua)
set(FUNCS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/geneval.lua)
set(EVENTS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gen_events.lua)
set(OPTIONS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genoptions.lua)
set(EVENTS_LIST_FILE ${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua)
set(EX_CMDS_DEFS_FILE ${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua)
set(EVAL_DEFS_FILE ${PROJECT_SOURCE_DIR}/src/nvim/eval.lua)
set(OPTIONS_LIST_FILE ${PROJECT_SOURCE_DIR}/src/nvim/options.lua)
set(UNICODE_TABLES_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genunicodetables.lua)
set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/unicode)
set(UNICODEDATA_FILE ${UNICODE_DIR}/UnicodeData.txt)
set(CASEFOLDING_FILE ${UNICODE_DIR}/CaseFolding.txt)
set(EASTASIANWIDTH_FILE ${UNICODE_DIR}/EastAsianWidth.txt)
file(GLOB UNICODE_FILES ${UNICODE_DIR}/*.txt)
set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h)
include_directories(${GENERATED_DIR})
include_directories(${CACHED_GENERATED_DIR})
include_directories(${GENERATED_INCLUDES_DIR})
file(MAKE_DIRECTORY ${GENERATED_DIR})
@@ -82,7 +88,7 @@ endforeach()
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
# Handle legacy files that don't yet pass -Wconversion.
# Legacy files that do not yet pass -Wconversion.
set(CONV_SOURCES
buffer.c
diff.c
@@ -112,6 +118,15 @@ endforeach()
if(NOT MSVC)
set_source_files_properties(
${CONV_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
# gperf generates ANSI-C with incorrect linkage, ignore it.
check_c_compiler_flag(-Wno-static-in-inline HAS_WNO_STATIC_IN_INLINE_FLAG)
if(HAS_WNO_STATIC_IN_INLINE_FLAG)
set_source_files_properties(
eval.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-static-in-inline -Wno-conversion")
else()
set_source_files_properties(
eval.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
endif()
endif()
if(DEFINED MIN_LOG_LEVEL)
@@ -138,9 +153,13 @@ separate_arguments(C_FLAGS_${build_type}_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS_${bu
set(gen_cflags ${gen_cflags} ${C_FLAGS_${build_type}_ARRAY} ${C_FLAGS_ARRAY})
foreach(sfile ${NEOVIM_SOURCES}
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c")
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c"
${GENERATED_API_DISPATCH})
get_filename_component(full_d ${sfile} PATH)
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
if(${d} MATCHES "^([.][.]|auto/)")
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
endif()
get_filename_component(f ${sfile} NAME)
get_filename_component(r ${sfile} NAME_WE)
if(NOT ${d} EQUAL ".")
@@ -172,28 +191,28 @@ endforeach()
add_custom_command(OUTPUT ${GENERATED_UNICODE_TABLES}
COMMAND ${LUA_PRG} ${UNICODE_TABLES_GENERATOR}
${UNICODEDATA_FILE}
${CASEFOLDING_FILE}
${EASTASIANWIDTH_FILE}
${UNICODE_DIR}
${GENERATED_UNICODE_TABLES}
DEPENDS
${UNICODE_TABLES_GENERATOR}
${UNICODEDATA_FILE}
${CASEFOLDING_FILE}
${EASTASIANWIDTH_FILE}
${UNICODE_FILES}
)
add_custom_command(OUTPUT ${MSGPACK_DISPATCH}
COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${API_HEADERS} ${MSGPACK_DISPATCH}
add_custom_command(OUTPUT ${GENERATED_API_DISPATCH} ${GENERATED_FUNCS_METADATA}
${API_METADATA}
COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}
${API_HEADERS} ${GENERATED_API_DISPATCH}
${GENERATED_FUNCS_METADATA} ${API_METADATA}
DEPENDS
${API_HEADERS}
${MSGPACK_RPC_HEADERS}
${DISPATCH_GENERATOR}
${CMAKE_CURRENT_LIST_DIR}/api/dispatch_deprecated.lua
)
list(APPEND NEOVIM_GENERATED_SOURCES
"${PROJECT_BINARY_DIR}/config/auto/pathdef.c"
"${MSGPACK_DISPATCH}"
"${GENERATED_API_DISPATCH}"
"${GENERATED_EX_CMDS_ENUM}"
"${GENERATED_EX_CMDS_DEFS}"
"${GENERATED_EVENTS_ENUM}"
@@ -208,6 +227,19 @@ add_custom_command(OUTPUT ${GENERATED_EX_CMDS_ENUM} ${GENERATED_EX_CMDS_DEFS}
DEPENDS ${EX_CMDS_GENERATOR} ${EX_CMDS_DEFS_FILE}
)
if(NOT GPERF_PRG)
message(FATAL_ERROR "gperf was not found.")
endif()
add_custom_command(OUTPUT ${GENERATED_FUNCS} ${FUNCS_DATA}
COMMAND ${LUA_PRG} ${FUNCS_GENERATOR}
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_DIR} ${API_METADATA} ${FUNCS_DATA}
COMMAND ${GPERF_PRG}
${GENERATED_FUNCS_HASH_INPUT} --output-file=${GENERATED_FUNCS}
DEPENDS ${FUNCS_GENERATOR} ${EVAL_DEFS_FILE} ${API_METADATA}
)
list(APPEND NEOVIM_GENERATED_SOURCES
"${GENERATED_FUNCS}")
add_custom_command(OUTPUT ${GENERATED_EVENTS_ENUM} ${GENERATED_EVENTS_NAMES_MAP}
COMMAND ${LUA_PRG} ${EVENTS_GENERATOR}
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_EVENTS_ENUM} ${GENERATED_EVENTS_NAMES_MAP}
@@ -294,6 +326,7 @@ elseif(CLANG_TSAN)
message(STATUS "Enabling Clang thread sanitizer for nvim.")
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ")
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fsanitize=thread ")
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fPIE ")
set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=thread ")
endif()

View File

@@ -14,7 +14,6 @@
#include "nvim/memline.h"
#include "nvim/memory.h"
#include "nvim/misc1.h"
#include "nvim/misc2.h"
#include "nvim/ex_cmds.h"
#include "nvim/mark.h"
#include "nvim/fileio.h"
@@ -29,10 +28,10 @@
/// Gets the buffer line count
///
/// @param buffer The buffer handle
/// @param[out] err Details of an error that may have occurred
/// @return The line count
Integer buffer_line_count(Buffer buffer, Error *err)
/// @param buffer Buffer handle
/// @param[out] err Error details, if any
/// @return Line count
Integer nvim_buf_line_count(Buffer buffer, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -45,22 +44,22 @@ Integer buffer_line_count(Buffer buffer, Error *err)
/// Gets a buffer line
///
/// @deprecated use buffer_get_lines instead.
/// @deprecated use nvim_buf_get_lines instead.
/// for positive indices (including 0) use
/// "buffer_get_lines(buffer, index, index+1, true)"
/// "nvim_buf_get_lines(buffer, index, index+1, true)"
/// for negative indices use
/// "buffer_get_lines(buffer, index-1, index, true)"
/// "nvim_buf_get_lines(buffer, index-1, index, true)"
///
/// @param buffer The buffer handle
/// @param index The line index
/// @param[out] err Details of an error that may have occurred
/// @return The line string
/// @param buffer Buffer handle
/// @param index Line index
/// @param[out] err Error details, if any
/// @return Line string
String buffer_get_line(Buffer buffer, Integer index, Error *err)
{
String rv = { .size = 0 };
index = convert_index(index);
Array slice = buffer_get_lines(buffer, index, index+1, true, err);
Array slice = nvim_buf_get_lines(0, buffer, index, index+1, true, err);
if (!err->set && slice.size) {
rv = slice.items[0].data.string;
@@ -73,64 +72,64 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
/// Sets a buffer line
///
/// @deprecated use buffer_set_lines instead.
/// @deprecated use nvim_buf_set_lines instead.
/// for positive indices use
/// "buffer_set_lines(buffer, index, index+1, true, [line])"
/// "nvim_buf_set_lines(buffer, index, index+1, true, [line])"
/// for negative indices use
/// "buffer_set_lines(buffer, index-1, index, true, [line])"
/// "nvim_buf_set_lines(buffer, index-1, index, true, [line])"
///
/// @param buffer The buffer handle
/// @param index The line index
/// @param line The new line.
/// @param[out] err Details of an error that may have occurred
/// @param buffer Buffer handle
/// @param index Line index
/// @param line Contents of the new line
/// @param[out] err Error details, if any
void buffer_set_line(Buffer buffer, Integer index, String line, Error *err)
{
Object l = STRING_OBJ(line);
Array array = { .items = &l, .size = 1 };
index = convert_index(index);
buffer_set_lines(buffer, index, index+1, true, array, err);
nvim_buf_set_lines(0, buffer, index, index+1, true, array, err);
}
/// Deletes a buffer line
///
/// @deprecated use buffer_set_lines instead.
/// @deprecated use nvim_buf_set_lines instead.
/// for positive indices use
/// "buffer_set_lines(buffer, index, index+1, true, [])"
/// "nvim_buf_set_lines(buffer, index, index+1, true, [])"
/// for negative indices use
/// "buffer_set_lines(buffer, index-1, index, true, [])"
/// @param buffer The buffer handle
/// @param index The line index
/// @param[out] err Details of an error that may have occurred
/// "nvim_buf_set_lines(buffer, index-1, index, true, [])"
/// @param buffer buffer handle
/// @param index line index
/// @param[out] err Error details, if any
void buffer_del_line(Buffer buffer, Integer index, Error *err)
{
Array array = ARRAY_DICT_INIT;
index = convert_index(index);
buffer_set_lines(buffer, index, index+1, true, array, err);
nvim_buf_set_lines(0, buffer, index, index+1, true, array, err);
}
/// Retrieves a line range from the buffer
///
/// @deprecated use buffer_get_lines(buffer, newstart, newend, false)
/// @deprecated use nvim_buf_get_lines(buffer, newstart, newend, false)
/// where newstart = start + int(not include_start) - int(start < 0)
/// newend = end + int(include_end) - int(end < 0)
/// int(bool) = 1 if bool is true else 0
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index
/// @param include_start True if the slice includes the `start` parameter
/// @param include_end True if the slice includes the `end` parameter
/// @param[out] err Details of an error that may have occurred
/// @return An array of lines
/// @param buffer Buffer handle
/// @param start First line index
/// @param end Last line index
/// @param include_start True if the slice includes the `start` parameter
/// @param include_end True if the slice includes the `end` parameter
/// @param[out] err Error details, if any
/// @return Array of lines
ArrayOf(String) buffer_get_line_slice(Buffer buffer,
Integer start,
Integer end,
Boolean include_start,
Boolean include_end,
Error *err)
Integer start,
Integer end,
Boolean include_start,
Boolean include_end,
Error *err)
{
start = convert_index(start) + !include_start;
end = convert_index(end) + include_end;
return buffer_get_lines(buffer, start , end, false, err);
return nvim_buf_get_lines(0, buffer, start , end, false, err);
}
@@ -143,17 +142,18 @@ ArrayOf(String) buffer_get_line_slice(Buffer buffer,
/// Out-of-bounds indices are clamped to the nearest valid value, unless
/// `strict_indexing` is set.
///
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index (exclusive)
/// @param strict_indexing whether out-of-bounds should be an error.
/// @param[out] err Details of an error that may have occurred
/// @return An array of lines
ArrayOf(String) buffer_get_lines(Buffer buffer,
Integer start,
Integer end,
Boolean strict_indexing,
Error *err)
/// @param buffer Buffer handle
/// @param start First line index
/// @param end Last line index (exclusive)
/// @param strict_indexing Whether out-of-bounds should be an error.
/// @param[out] err Error details, if any
/// @return Array of lines
ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
Buffer buffer,
Integer start,
Integer end,
Boolean strict_indexing,
Error *err)
{
Array rv = ARRAY_DICT_INIT;
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -191,7 +191,9 @@ ArrayOf(String) buffer_get_lines(Buffer buffer,
Object str = STRING_OBJ(cstr_to_string(bufstr));
// Vim represents NULs as NLs, but this may confuse clients.
strchrsub(str.data.string.data, '\n', '\0');
if (channel_id != INTERNAL_CALL) {
strchrsub(str.data.string.data, '\n', '\0');
}
rv.items[i] = str;
}
@@ -212,30 +214,30 @@ end:
/// Replaces a line range on the buffer
///
/// @deprecated use buffer_set_lines(buffer, newstart, newend, false, lines)
/// @deprecated use nvim_buf_set_lines(buffer, newstart, newend, false, lines)
/// where newstart = start + int(not include_start) + int(start < 0)
/// newend = end + int(include_end) + int(end < 0)
/// int(bool) = 1 if bool is true else 0
///
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index
/// @param include_start True if the slice includes the `start` parameter
/// @param include_end True if the slice includes the `end` parameter
/// @param replacement An array of lines to use as replacement(A 0-length
// array will simply delete the line range)
/// @param[out] err Details of an error that may have occurred
/// @param buffer Buffer handle
/// @param start First line index
/// @param end Last line index
/// @param include_start True if the slice includes the `start` parameter
/// @param include_end True if the slice includes the `end` parameter
/// @param replacement Array of lines to use as replacement (0-length
// array will delete the line range)
/// @param[out] err Error details, if any
void buffer_set_line_slice(Buffer buffer,
Integer start,
Integer end,
Boolean include_start,
Boolean include_end,
ArrayOf(String) replacement,
Error *err)
Integer start,
Integer end,
Boolean include_start,
Boolean include_end,
ArrayOf(String) replacement, // NOLINT
Error *err)
{
start = convert_index(start) + !include_start;
end = convert_index(end) + include_end;
buffer_set_lines(buffer, start, end, false, replacement, err);
nvim_buf_set_lines(0, buffer, start, end, false, replacement, err);
}
@@ -251,18 +253,19 @@ void buffer_set_line_slice(Buffer buffer,
/// Out-of-bounds indices are clamped to the nearest valid value, unless
/// `strict_indexing` is set.
///
/// @param buffer The buffer handle
/// @param start The first line index
/// @param end The last line index (exclusive)
/// @param strict_indexing whether out-of-bounds should be an error.
/// @param replacement An array of lines to use as replacement
/// @param[out] err Details of an error that may have occurred
void buffer_set_lines(Buffer buffer,
Integer start,
Integer end,
Boolean strict_indexing,
ArrayOf(String) replacement,
Error *err)
/// @param buffer Buffer handle
/// @param start First line index
/// @param end Last line index (exclusive)
/// @param strict_indexing Whether out-of-bounds should be an error.
/// @param replacement Array of lines to use as replacement
/// @param[out] err Error details, if any
void nvim_buf_set_lines(uint64_t channel_id,
Buffer buffer,
Integer start,
Integer end,
Boolean strict_indexing,
ArrayOf(String) replacement, // NOLINT
Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -309,7 +312,7 @@ void buffer_set_lines(Buffer buffer,
// line and convert NULs to newlines to avoid truncation.
lines[i] = xmallocz(l.size);
for (size_t j = 0; j < l.size; j++) {
if (l.data[j] == '\n') {
if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) {
api_set_error(err, Exception, _("string cannot contain newlines"));
new_len = i + 1;
goto end;
@@ -408,11 +411,11 @@ end:
/// Gets a buffer-scoped (b:) variable.
///
/// @param buffer The buffer handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The variable value
Object buffer_get_var(Buffer buffer, String name, Error *err)
/// @param buffer Buffer handle
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Variable value
Object nvim_buf_get_var(Buffer buffer, String name, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -425,11 +428,46 @@ Object buffer_get_var(Buffer buffer, String name, Error *err)
/// Sets a buffer-scoped (b:) variable
///
/// @param buffer The buffer handle
/// @param name The variable name
/// @param value The variable value
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @param buffer Buffer handle
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
void nvim_buf_set_var(Buffer buffer, String name, Object value, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
return;
}
dict_set_value(buf->b_vars, name, value, false, false, err);
}
/// Removes a buffer-scoped (b:) variable
///
/// @param buffer Buffer handle
/// @param name Variable name
/// @param[out] err Error details, if any
void nvim_buf_del_var(Buffer buffer, String name, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
return;
}
dict_set_value(buf->b_vars, name, NIL, true, false, err);
}
/// Sets a buffer-scoped (b:) variable
///
/// @deprecated
///
/// @param buffer Buffer handle
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
/// @return Old value or nil if there was no previous value.
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
@@ -441,18 +479,17 @@ Object buffer_set_var(Buffer buffer, String name, Object value, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(buf->b_vars, name, value, false, err);
return dict_set_value(buf->b_vars, name, value, false, true, err);
}
/// Removes a buffer-scoped (b:) variable
///
/// @param buffer The buffer handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @deprecated
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
/// @param buffer Buffer handle
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Old value
Object buffer_del_var(Buffer buffer, String name, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -461,16 +498,17 @@ Object buffer_del_var(Buffer buffer, String name, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(buf->b_vars, name, NIL, true, err);
return dict_set_value(buf->b_vars, name, NIL, true, true, err);
}
/// Gets a buffer option value
///
/// @param buffer The buffer handle
/// @param name The option name
/// @param[out] err Details of an error that may have occurred
/// @return The option value
Object buffer_get_option(Buffer buffer, String name, Error *err)
/// @param buffer Buffer handle
/// @param name Option name
/// @param[out] err Error details, if any
/// @return Option value
Object nvim_buf_get_option(Buffer buffer, String name, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -481,14 +519,14 @@ Object buffer_get_option(Buffer buffer, String name, Error *err)
return get_option_from(buf, SREQ_BUF, name, err);
}
/// Sets a buffer option value. Passing 'nil' as value deletes the option(only
/// Sets a buffer option value. Passing 'nil' as value deletes the option (only
/// works if there's a global fallback)
///
/// @param buffer The buffer handle
/// @param name The option name
/// @param value The option value
/// @param[out] err Details of an error that may have occurred
void buffer_set_option(Buffer buffer, String name, Object value, Error *err)
/// @param buffer Buffer handle
/// @param name Option name
/// @param value Option value
/// @param[out] err Error details, if any
void nvim_buf_set_option(Buffer buffer, String name, Object value, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -501,10 +539,10 @@ void buffer_set_option(Buffer buffer, String name, Object value, Error *err)
/// Gets the buffer number
///
/// @param buffer The buffer handle
/// @param[out] err Details of an error that may have occurred
/// @return The buffer number
Integer buffer_get_number(Buffer buffer, Error *err)
/// @param buffer Buffer handle
/// @param[out] err Error details, if any
/// @return Buffer number
Integer nvim_buf_get_number(Buffer buffer, Error *err)
{
Integer rv = 0;
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -518,10 +556,10 @@ Integer buffer_get_number(Buffer buffer, Error *err)
/// Gets the full file name for the buffer
///
/// @param buffer The buffer handle
/// @param[out] err Details of an error that may have occurred
/// @return The buffer name
String buffer_get_name(Buffer buffer, Error *err)
/// @param buffer Buffer handle
/// @param[out] err Error details, if any
/// @return Buffer name
String nvim_buf_get_name(Buffer buffer, Error *err)
{
String rv = STRING_INIT;
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -535,10 +573,10 @@ String buffer_get_name(Buffer buffer, Error *err)
/// Sets the full file name for a buffer
///
/// @param buffer The buffer handle
/// @param name The buffer name
/// @param[out] err Details of an error that may have occurred
void buffer_set_name(Buffer buffer, String name, Error *err)
/// @param buffer Buffer handle
/// @param name Buffer name
/// @param[out] err Error details, if any
void nvim_buf_set_name(Buffer buffer, String name, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -565,9 +603,9 @@ void buffer_set_name(Buffer buffer, String name, Error *err)
/// Checks if a buffer is valid
///
/// @param buffer The buffer handle
/// @param buffer Buffer handle
/// @return true if the buffer is valid, false otherwise
Boolean buffer_is_valid(Buffer buffer)
Boolean nvim_buf_is_valid(Buffer buffer)
{
Error stub = ERROR_INIT;
return find_buffer_by_handle(buffer, &stub) != NULL;
@@ -575,13 +613,13 @@ Boolean buffer_is_valid(Buffer buffer)
/// Inserts a sequence of lines to a buffer at a certain index
///
/// @deprecated use buffer_set_lines(buffer, lnum, lnum, true, lines)
/// @deprecated use nvim_buf_set_lines(buffer, lnum, lnum, true, lines)
///
/// @param buffer The buffer handle
/// @param lnum Insert the lines after `lnum`. If negative, it will append
/// to the end of the buffer.
/// @param lines An array of lines
/// @param[out] err Details of an error that may have occurred
/// @param buffer Buffer handle
/// @param lnum Insert the lines after `lnum`. If negative, appends to
/// the end of the buffer.
/// @param lines Array of lines
/// @param[out] err Error details, if any
void buffer_insert(Buffer buffer,
Integer lnum,
ArrayOf(String) lines,
@@ -589,16 +627,16 @@ void buffer_insert(Buffer buffer,
{
// "lnum" will be the index of the line after inserting,
// no matter if it is negative or not
buffer_set_lines(buffer, lnum, lnum, true, lines, err);
nvim_buf_set_lines(0, buffer, lnum, lnum, true, lines, err);
}
/// Return a tuple (row,col) representing the position of the named mark
///
/// @param buffer The buffer handle
/// @param name The mark's name
/// @param[out] err Details of an error that may have occurred
/// @return The (row, col) tuple
ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
/// @param buffer Buffer handle
/// @param name Mark name
/// @param[out] err Error details, if any
/// @return (row, col) tuple
ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
{
Array rv = ARRAY_DICT_INIT;
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -648,7 +686,7 @@ ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
/// called with src_id = 0, an unique source id is generated and returned.
/// Succesive calls can pass in it as "src_id" to add new highlights to the same
/// source group. All highlights in the same group can then be cleared with
/// buffer_clear_highlight. If the highlight never will be manually deleted
/// nvim_buf_clear_highlight. If the highlight never will be manually deleted
/// pass in -1 for "src_id".
///
/// If "hl_group" is the empty string no highlight is added, but a new src_id
@@ -656,23 +694,23 @@ ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
/// request an unique src_id at initialization, and later asynchronously add and
/// clear highlights in response to buffer changes.
///
/// @param buffer The buffer handle
/// @param src_id Source group to use or 0 to use a new group,
/// or -1 for ungrouped highlight
/// @param hl_group Name of the highlight group to use
/// @param line The line to highlight
/// @param col_start Start of range of columns to highlight
/// @param col_end End of range of columns to highlight,
/// or -1 to highlight to end of line
/// @param[out] err Details of an error that may have occurred
/// @param buffer Buffer handle
/// @param src_id Source group to use or 0 to use a new group,
/// or -1 for ungrouped highlight
/// @param hl_group Name of the highlight group to use
/// @param line Line to highlight
/// @param col_start Start of range of columns to highlight
/// @param col_end End of range of columns to highlight,
/// or -1 to highlight to end of line
/// @param[out] err Error details, if any
/// @return The src_id that was used
Integer buffer_add_highlight(Buffer buffer,
Integer src_id,
String hl_group,
Integer line,
Integer col_start,
Integer col_end,
Error *err)
Integer nvim_buf_add_highlight(Buffer buffer,
Integer src_id,
String hl_group,
Integer line,
Integer col_start,
Integer col_end,
Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {
@@ -702,17 +740,17 @@ Integer buffer_add_highlight(Buffer buffer,
/// To clear a source group in the entire buffer, pass in 1 and -1 to
/// line_start and line_end respectively.
///
/// @param buffer The buffer handle
/// @param src_id Highlight source group to clear, or -1 to clear all groups.
/// @param buffer Buffer handle
/// @param src_id Highlight source group to clear, or -1 to clear all.
/// @param line_start Start of range of lines to clear
/// @param line_end End of range of lines to clear (exclusive)
/// or -1 to clear to end of file.
/// @param[out] err Details of an error that may have occurred
void buffer_clear_highlight(Buffer buffer,
Integer src_id,
Integer line_start,
Integer line_end,
Error *err)
/// @param line_end End of range of lines to clear (exclusive) or -1 to clear
/// to end of file.
/// @param[out] err Error details, if any
void nvim_buf_clear_highlight(Buffer buffer,
Integer src_id,
Integer line_start,
Integer line_end,
Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
if (!buf) {

View File

@@ -0,0 +1,69 @@
local deprecated_aliases = {
nvim_buf_add_highlight="buffer_add_highlight",
nvim_buf_clear_highlight="buffer_clear_highlight",
nvim_buf_get_lines="buffer_get_lines",
nvim_buf_get_mark="buffer_get_mark",
nvim_buf_get_name="buffer_get_name",
nvim_buf_get_number="buffer_get_number",
nvim_buf_get_option="buffer_get_option",
nvim_buf_get_var="buffer_get_var",
nvim_buf_is_valid="buffer_is_valid",
nvim_buf_line_count="buffer_line_count",
nvim_buf_set_lines="buffer_set_lines",
nvim_buf_set_name="buffer_set_name",
nvim_buf_set_option="buffer_set_option",
nvim_call_function="vim_call_function",
nvim_command="vim_command",
nvim_command_output="vim_command_output",
nvim_del_current_line="vim_del_current_line",
nvim_err_write="vim_err_write",
nvim_err_writeln="vim_report_error",
nvim_eval="vim_eval",
nvim_feedkeys="vim_feedkeys",
nvim_get_api_info="vim_get_api_info",
nvim_get_color_by_name="vim_name_to_color",
nvim_get_color_map="vim_get_color_map",
nvim_get_current_buf="vim_get_current_buffer",
nvim_get_current_line="vim_get_current_line",
nvim_get_current_tabpage="vim_get_current_tabpage",
nvim_get_current_win="vim_get_current_window",
nvim_get_option="vim_get_option",
nvim_get_var="vim_get_var",
nvim_get_vvar="vim_get_vvar",
nvim_input="vim_input",
nvim_list_bufs="vim_get_buffers",
nvim_list_runtime_paths="vim_list_runtime_paths",
nvim_list_tabpages="vim_get_tabpages",
nvim_list_wins="vim_get_windows",
nvim_out_write="vim_out_write",
nvim_replace_termcodes="vim_replace_termcodes",
nvim_set_current_buf="vim_set_current_buffer",
nvim_set_current_dir="vim_change_directory",
nvim_set_current_line="vim_set_current_line",
nvim_set_current_tabpage="vim_set_current_tabpage",
nvim_set_current_win="vim_set_current_window",
nvim_set_option="vim_set_option",
nvim_strwidth="vim_strwidth",
nvim_subscribe="vim_subscribe",
nvim_tabpage_get_var="tabpage_get_var",
nvim_tabpage_get_win="tabpage_get_window",
nvim_tabpage_is_valid="tabpage_is_valid",
nvim_tabpage_list_wins="tabpage_get_windows",
nvim_ui_detach="ui_detach",
nvim_ui_try_resize="ui_try_resize",
nvim_unsubscribe="vim_unsubscribe",
nvim_win_get_buf="window_get_buffer",
nvim_win_get_cursor="window_get_cursor",
nvim_win_get_height="window_get_height",
nvim_win_get_option="window_get_option",
nvim_win_get_position="window_get_position",
nvim_win_get_tabpage="window_get_tabpage",
nvim_win_get_var="window_get_var",
nvim_win_get_width="window_get_width",
nvim_win_is_valid="window_is_valid",
nvim_win_set_cursor="window_set_cursor",
nvim_win_set_height="window_set_height",
nvim_win_set_option="window_set_option",
nvim_win_set_width="window_set_width",
}
return deprecated_aliases

View File

@@ -9,13 +9,15 @@
#define STRING_INIT {.data = NULL, .size = 0}
#define OBJECT_INIT { .type = kObjectTypeNil }
#define ERROR_INIT { .set = false }
#define REMOTE_TYPE(type) typedef uint64_t type
#define REMOTE_TYPE(type) typedef handle_T type
#ifdef INCLUDE_GENERATED_DECLARATIONS
# define ArrayOf(...) Array
# define DictionaryOf(...) Dictionary
#endif
typedef int handle_T;
// Basic types
typedef enum {
kErrorTypeException,
@@ -31,6 +33,9 @@ typedef enum {
/// Used as the message ID of notifications.
#define NO_RESPONSE UINT64_MAX
/// Used as channel_id when the call is local.
#define INTERNAL_CALL UINT64_MAX
typedef struct {
ErrorType type;
char msg[1024];
@@ -86,9 +91,6 @@ typedef enum {
struct object {
ObjectType type;
union {
Buffer buffer;
Window window;
Tabpage tabpage;
Boolean boolean;
Integer integer;
Float floating;

View File

@@ -0,0 +1,45 @@
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <assert.h>
#include <msgpack.h>
#include "nvim/map.h"
#include "nvim/log.h"
#include "nvim/vim.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/api/private/dispatch.h"
#include "nvim/api/private/helpers.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/buffer.h"
#include "nvim/api/tabpage.h"
#include "nvim/api/ui.h"
#include "nvim/api/vim.h"
#include "nvim/api/window.h"
static Map(String, MsgpackRpcRequestHandler) *methods = NULL;
static void msgpack_rpc_add_method_handler(String method,
MsgpackRpcRequestHandler handler)
{
map_put(String, MsgpackRpcRequestHandler)(methods, method, handler);
}
MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
size_t name_len)
{
String m = { .data = (char *)name, .size = name_len };
MsgpackRpcRequestHandler rv =
map_get(String, MsgpackRpcRequestHandler)(methods, m);
if (!rv.fn) {
rv.fn = msgpack_rpc_handle_missing_method;
}
return rv;
}
#ifdef INCLUDE_GENERATED_DECLARATIONS
#include "api/private/dispatch_wrappers.generated.h"
#endif

View File

@@ -0,0 +1,23 @@
#ifndef NVIM_API_PRIVATE_DISPATCH_H
#define NVIM_API_PRIVATE_DISPATCH_H
#include "nvim/api/private/defs.h"
typedef Object (*ApiDispatchWrapper)(uint64_t channel_id,
Array args,
Error *error);
/// The rpc_method_handlers table, used in msgpack_rpc_dispatch(), stores
/// functions of this type.
typedef struct {
ApiDispatchWrapper fn;
bool async; // function is always safe to run immediately instead of being
// put in a request queue for handling when nvim waits for input.
} MsgpackRpcRequestHandler;
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/dispatch.h.generated.h"
# include "api/private/dispatch_wrappers.h.generated.h"
#endif
#endif // NVIM_API_PRIVATE_DISPATCH_H

View File

@@ -5,30 +5,26 @@
#include "nvim/map.h"
#include "nvim/api/private/handle.h"
#define HANDLE_INIT(name) name##_handles = pmap_new(uint64_t)()
#define HANDLE_INIT(name) name##_handles = pmap_new(handle_T)()
#define HANDLE_IMPL(type, name) \
static PMap(uint64_t) *name##_handles = NULL; \
static PMap(handle_T) *name##_handles = NULL; /* NOLINT */ \
\
type *handle_get_##name(uint64_t handle) \
type *handle_get_##name(handle_T handle) \
{ \
return pmap_get(uint64_t)(name##_handles, handle); \
return pmap_get(handle_T)(name##_handles, handle); \
} \
\
void handle_register_##name(type *name) \
{ \
assert(!name->handle); \
name->handle = next_handle++; \
pmap_put(uint64_t)(name##_handles, name->handle, name); \
pmap_put(handle_T)(name##_handles, name->handle, name); \
} \
\
void handle_unregister_##name(type *name) \
{ \
pmap_del(uint64_t)(name##_handles, name->handle); \
pmap_del(handle_T)(name##_handles, name->handle); \
}
static uint64_t next_handle = 1;
HANDLE_IMPL(buf_T, buffer)
HANDLE_IMPL(win_T, window)
HANDLE_IMPL(tabpage_T, tabpage)

View File

@@ -3,9 +3,10 @@
#include "nvim/vim.h"
#include "nvim/buffer_defs.h"
#include "nvim/api/private/defs.h"
#define HANDLE_DECLS(type, name) \
type *handle_get_##name(uint64_t handle); \
type *handle_get_##name(handle_T handle); \
void handle_register_##name(type *name); \
void handle_unregister_##name(type *name);

View File

@@ -7,6 +7,7 @@
#include "nvim/api/private/helpers.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/handle.h"
#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/ascii.h"
#include "nvim/vim.h"
#include "nvim/buffer.h"
@@ -17,6 +18,7 @@
#include "nvim/map.h"
#include "nvim/option.h"
#include "nvim/option_defs.h"
#include "nvim/version.h"
#include "nvim/eval/typval_encode.h"
#include "nvim/lib/kvec.h"
@@ -27,6 +29,7 @@ typedef struct {
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/private/helpers.c.generated.h"
# include "api/private/funcs_metadata.generated.h"
#endif
/// Start block that may cause vimscript exceptions
@@ -104,10 +107,11 @@ Object dict_get_value(dict_T *dict, String key, Error *err)
/// @param value The new value
/// @param del Delete key in place of setting it. Argument `value` is ignored in
/// this case.
/// @param retval If true the old value will be converted and returned.
/// @param[out] err Details of an error that may have occurred
/// @return the old value, if any
/// @return The old value if `retval` is true and the key was present, else NIL
Object dict_set_value(dict_T *dict, String key, Object value, bool del,
Error *err)
bool retval, Error *err)
{
Object rv = OBJECT_INIT;
@@ -135,7 +139,9 @@ Object dict_set_value(dict_T *dict, String key, Object value, bool del,
api_set_error(err, Validation, _("Key \"%s\" doesn't exist"), key.data);
} else {
// Return the old value
rv = vim_to_object(&di->di_tv);
if (retval) {
rv = vim_to_object(&di->di_tv);
}
// Delete the entry
hashitem_T *hi = hash_find(&dict->dv_hashtab, di->di_key);
hash_remove(&dict->dv_hashtab, hi);
@@ -156,7 +162,9 @@ Object dict_set_value(dict_T *dict, String key, Object value, bool del,
dict_add(dict, di);
} else {
// Return the old value
rv = vim_to_object(&di->di_tv);
if (retval) {
rv = vim_to_object(&di->di_tv);
}
clear_tv(&di->di_tv);
}
@@ -363,11 +371,10 @@ static inline void typval_encode_list_start(EncodedData *const edata,
const size_t len)
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
{
const Object obj = OBJECT_INIT;
kv_push(edata->stack, ARRAY_OBJ(((Array) {
.capacity = len,
.size = 0,
.items = xmalloc(len * sizeof(*obj.data.array.items)),
.items = xmalloc(len * sizeof(*((Object *)NULL)->data.array.items)),
})));
}
@@ -404,11 +411,10 @@ static inline void typval_encode_dict_start(EncodedData *const edata,
const size_t len)
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
{
const Object obj = OBJECT_INIT;
kv_push(edata->stack, DICTIONARY_OBJ(((Dictionary) {
.capacity = len,
.size = 0,
.items = xmalloc(len * sizeof(*obj.data.dictionary.items)),
.items = xmalloc(len * sizeof(*((Object *)NULL)->data.dictionary.items)),
})));
}
@@ -507,6 +513,10 @@ Object vim_to_object(typval_T *obj)
buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
{
if (buffer == 0) {
return curbuf;
}
buf_T *rv = handle_get_buffer(buffer);
if (!rv) {
@@ -518,6 +528,10 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
win_T * find_window_by_handle(Window window, Error *err)
{
if (window == 0) {
return curwin;
}
win_T *rv = handle_get_window(window);
if (!rv) {
@@ -529,6 +543,10 @@ win_T * find_window_by_handle(Window window, Error *err)
tabpage_T * find_tab_by_handle(Tabpage tabpage, Error *err)
{
if (tabpage == 0) {
return curtab;
}
tabpage_T *rv = handle_get_tabpage(tabpage);
if (!rv) {
@@ -572,10 +590,16 @@ String cstr_as_string(char *str) FUNC_ATTR_PURE
return (String) {.data = str, .size = strlen(str)};
}
/// Converts from type Object to a VimL value.
///
/// @param obj Object to convert from.
/// @param tv Conversion result is placed here. On failure member v_type is
/// set to VAR_UNKNOWN (no allocation was made for this variable).
/// returns true if conversion is successful, otherwise false.
bool object_to_vim(Object obj, typval_T *tv, Error *err)
{
tv->v_type = VAR_UNKNOWN;
tv->v_lock = 0;
tv->v_lock = VAR_UNLOCKED;
switch (obj.type) {
case kObjectTypeNil:
@@ -592,13 +616,14 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
case kObjectTypeWindow:
case kObjectTypeTabpage:
case kObjectTypeInteger:
if (obj.data.integer > INT_MAX || obj.data.integer < INT_MIN) {
if (obj.data.integer > VARNUMBER_MAX
|| obj.data.integer < VARNUMBER_MIN) {
api_set_error(err, Validation, _("Integer value outside range"));
return false;
}
tv->v_type = VAR_NUMBER;
tv->vval.v_number = (int)obj.data.integer;
tv->vval.v_number = (varnumber_T)obj.data.integer;
break;
case kObjectTypeFloat:
@@ -616,9 +641,8 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
}
break;
case kObjectTypeArray:
tv->v_type = VAR_LIST;
tv->vval.v_list = list_alloc();
case kObjectTypeArray: {
list_T *list = list_alloc();
for (uint32_t i = 0; i < obj.data.array.size; i++) {
Object item = obj.data.array.items[i];
@@ -627,45 +651,51 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
if (!object_to_vim(item, &li->li_tv, err)) {
// cleanup
listitem_free(li);
list_free(tv->vval.v_list, true);
list_free(list, true);
return false;
}
list_append(tv->vval.v_list, li);
list_append(list, li);
}
tv->vval.v_list->lv_refcount++;
break;
list->lv_refcount++;
case kObjectTypeDictionary:
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict_alloc();
tv->v_type = VAR_LIST;
tv->vval.v_list = list;
break;
}
case kObjectTypeDictionary: {
dict_T *dict = dict_alloc();
for (uint32_t i = 0; i < obj.data.dictionary.size; i++) {
KeyValuePair item = obj.data.dictionary.items[i];
String key = item.key;
if (key.size == 0) {
api_set_error(err,
Validation,
api_set_error(err, Validation,
_("Empty dictionary keys aren't allowed"));
// cleanup
dict_free(tv->vval.v_dict, true);
dict_free(dict, true);
return false;
}
dictitem_T *di = dictitem_alloc((uint8_t *) key.data);
dictitem_T *di = dictitem_alloc((uint8_t *)key.data);
if (!object_to_vim(item.value, &di->di_tv, err)) {
// cleanup
dictitem_free(di);
dict_free(tv->vval.v_dict, true);
dict_free(dict, true);
return false;
}
dict_add(tv->vval.v_dict, di);
dict_add(dict, di);
}
tv->vval.v_dict->dv_refcount++;
dict->dv_refcount++;
tv->v_type = VAR_DICT;
tv->vval.v_dict = dict;
break;
}
default:
abort();
}
@@ -735,7 +765,8 @@ Dictionary api_metadata(void)
static Dictionary metadata = ARRAY_DICT_INIT;
if (!metadata.size) {
msgpack_rpc_init_function_metadata(&metadata);
PUT(metadata, "version", DICTIONARY_OBJ(version_dict()));
init_function_metadata(&metadata);
init_error_type_metadata(&metadata);
init_type_metadata(&metadata);
}
@@ -743,6 +774,22 @@ Dictionary api_metadata(void)
return copy_object(DICTIONARY_OBJ(metadata)).data.dictionary;
}
static void init_function_metadata(Dictionary *metadata)
{
msgpack_unpacked unpacked;
msgpack_unpacked_init(&unpacked);
if (msgpack_unpack_next(&unpacked,
(const char *)funcs_metadata,
sizeof(funcs_metadata),
NULL) != MSGPACK_UNPACK_SUCCESS) {
abort();
}
Object functions;
msgpack_rpc_to_object(&unpacked.data, &functions);
msgpack_unpacked_destroy(&unpacked);
PUT(*metadata, "functions", functions);
}
static void init_error_type_metadata(Dictionary *metadata)
{
Dictionary types = ARRAY_DICT_INIT;
@@ -758,18 +805,22 @@ static void init_error_type_metadata(Dictionary *metadata)
PUT(*metadata, "error_types", DICTIONARY_OBJ(types));
}
static void init_type_metadata(Dictionary *metadata)
{
Dictionary types = ARRAY_DICT_INIT;
Dictionary buffer_metadata = ARRAY_DICT_INIT;
PUT(buffer_metadata, "id", INTEGER_OBJ(kObjectTypeBuffer));
PUT(buffer_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_buf_")));
Dictionary window_metadata = ARRAY_DICT_INIT;
PUT(window_metadata, "id", INTEGER_OBJ(kObjectTypeWindow));
PUT(window_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_win_")));
Dictionary tabpage_metadata = ARRAY_DICT_INIT;
PUT(tabpage_metadata, "id", INTEGER_OBJ(kObjectTypeTabpage));
PUT(tabpage_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_tabpage_")));
PUT(types, "Buffer", DICTIONARY_OBJ(buffer_metadata));
PUT(types, "Window", DICTIONARY_OBJ(window_metadata));

View File

@@ -37,15 +37,15 @@
#define BUFFER_OBJ(s) ((Object) { \
.type = kObjectTypeBuffer, \
.data.buffer = s })
.data.integer = s })
#define WINDOW_OBJ(s) ((Object) { \
.type = kObjectTypeWindow, \
.data.window = s })
.data.integer = s })
#define TABPAGE_OBJ(s) ((Object) { \
.type = kObjectTypeTabpage, \
.data.tabpage = s })
.data.integer = s })
#define ARRAY_OBJ(a) ((Object) { \
.type = kObjectTypeArray, \

View File

@@ -11,10 +11,10 @@
/// Gets the windows in a tabpage
///
/// @param tabpage The tabpage
/// @param[out] err Details of an error that may have occurred
/// @return The windows in `tabpage`
ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err)
/// @param tabpage Tabpage
/// @param[out] err Error details, if any
/// @return List of windows in `tabpage`
ArrayOf(Window) nvim_tabpage_list_wins(Tabpage tabpage, Error *err)
{
Array rv = ARRAY_DICT_INIT;
tabpage_T *tab = find_tab_by_handle(tabpage, err);
@@ -39,11 +39,11 @@ ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err)
/// Gets a tab-scoped (t:) variable
///
/// @param tabpage The tab page handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The variable value
Object tabpage_get_var(Tabpage tabpage, String name, Error *err)
/// @param tabpage Tabpage handle
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Variable value
Object nvim_tabpage_get_var(Tabpage tabpage, String name, Error *err)
{
tabpage_T *tab = find_tab_by_handle(tabpage, err);
@@ -56,11 +56,49 @@ Object tabpage_get_var(Tabpage tabpage, String name, Error *err)
/// Sets a tab-scoped (t:) variable
///
/// @param tabpage handle
/// @param name The variable name
/// @param value The variable value
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @param tabpage Tabpage handle
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
void nvim_tabpage_set_var(Tabpage tabpage,
String name,
Object value,
Error *err)
{
tabpage_T *tab = find_tab_by_handle(tabpage, err);
if (!tab) {
return;
}
dict_set_value(tab->tp_vars, name, value, false, false, err);
}
/// Removes a tab-scoped (t:) variable
///
/// @param tabpage Tabpage handle
/// @param name Variable name
/// @param[out] err Error details, if any
void nvim_tabpage_del_var(Tabpage tabpage, String name, Error *err)
{
tabpage_T *tab = find_tab_by_handle(tabpage, err);
if (!tab) {
return;
}
dict_set_value(tab->tp_vars, name, NIL, true, false, err);
}
/// Sets a tab-scoped (t:) variable
///
/// @deprecated
///
/// @param tabpage Tabpage handle
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
/// @return Old value or nil if there was no previous value.
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
@@ -72,18 +110,17 @@ Object tabpage_set_var(Tabpage tabpage, String name, Object value, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(tab->tp_vars, name, value, false, err);
return dict_set_value(tab->tp_vars, name, value, false, true, err);
}
/// Removes a tab-scoped (t:) variable
///
/// @param tabpage handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @deprecated
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
/// @param tabpage Tabpage handle
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Old value
Object tabpage_del_var(Tabpage tabpage, String name, Error *err)
{
tabpage_T *tab = find_tab_by_handle(tabpage, err);
@@ -92,15 +129,15 @@ Object tabpage_del_var(Tabpage tabpage, String name, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(tab->tp_vars, name, NIL, true, err);
return dict_set_value(tab->tp_vars, name, NIL, true, true, err);
}
/// Gets the current window in a tab page
/// Gets the current window in a tabpage
///
/// @param tabpage The tab page handle
/// @param[out] err Details of an error that may have occurred
/// @return The Window handle
Window tabpage_get_window(Tabpage tabpage, Error *err)
/// @param tabpage Tabpage handle
/// @param[out] err Error details, if any
/// @return Window handle
Window nvim_tabpage_get_win(Tabpage tabpage, Error *err)
{
Window rv = 0;
tabpage_T *tab = find_tab_by_handle(tabpage, err);
@@ -110,7 +147,7 @@ Window tabpage_get_window(Tabpage tabpage, Error *err)
}
if (tab == curtab) {
return vim_get_current_window();
return nvim_get_current_win();
} else {
FOR_ALL_WINDOWS_IN_TAB(wp, tab) {
if (wp == tab->tp_curwin) {
@@ -122,11 +159,28 @@ Window tabpage_get_window(Tabpage tabpage, Error *err)
}
}
/// Checks if a tab page is valid
/// Gets the tabpage number
///
/// @param tabpage The tab page handle
/// @return true if the tab page is valid, false otherwise
Boolean tabpage_is_valid(Tabpage tabpage)
/// @param tabpage Tabpage handle
/// @param[out] err Error details, if any
/// @return Tabpage number
Integer nvim_tabpage_get_number(Tabpage tabpage, Error *err)
{
Integer rv = 0;
tabpage_T *tab = find_tab_by_handle(tabpage, err);
if (!tab) {
return rv;
}
return tabpage_index(tab);
}
/// Checks if a tabpage is valid
///
/// @param tabpage Tabpage handle
/// @return true if the tabpage is valid, false otherwise
Boolean nvim_tabpage_is_valid(Tabpage tabpage)
{
Error stub = ERROR_INIT;
return find_tab_by_handle(tabpage, &stub) != NULL;

View File

@@ -8,8 +8,10 @@
#include "nvim/memory.h"
#include "nvim/map.h"
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/api/ui.h"
#include "nvim/api/private/defs.h"
#include "nvim/api/private/helpers.h"
#include "nvim/popupmnu.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/ui.c.generated.h"
@@ -44,8 +46,9 @@ void remote_ui_disconnect(uint64_t channel_id)
xfree(ui);
}
void ui_attach(uint64_t channel_id, Integer width, Integer height,
Boolean enable_rgb, Error *err)
void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
Dictionary options, Error *err)
FUNC_API_NOEVAL
{
if (pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(err, Exception, _("UI already attached for channel"));
@@ -57,14 +60,11 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height,
_("Expected width > 0 and height > 0"));
return;
}
UIData *data = xmalloc(sizeof(UIData));
data->channel_id = channel_id;
data->buffer = (Array)ARRAY_DICT_INIT;
UI *ui = xcalloc(1, sizeof(UI));
ui->width = (int)width;
ui->height = (int)height;
ui->rgb = enable_rgb;
ui->data = data;
ui->rgb = true;
ui->pum_external = false;
ui->resize = remote_ui_resize;
ui->clear = remote_ui_clear;
ui->eol_clear = remote_ui_eol_clear;
@@ -88,37 +88,100 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height,
ui->suspend = remote_ui_suspend;
ui->set_title = remote_ui_set_title;
ui->set_icon = remote_ui_set_icon;
ui->event = remote_ui_event;
for (size_t i = 0; i < options.size; i++) {
ui_set_option(ui, options.items[i].key, options.items[i].value, err);
if (err->set) {
xfree(ui);
return;
}
}
UIData *data = xmalloc(sizeof(UIData));
data->channel_id = channel_id;
data->buffer = (Array)ARRAY_DICT_INIT;
ui->data = data;
pmap_put(uint64_t)(connected_uis, channel_id, ui);
ui_attach_impl(ui);
return;
}
void ui_detach(uint64_t channel_id, Error *err)
/// @deprecated
void ui_attach(uint64_t channel_id, Integer width, Integer height,
Boolean enable_rgb, Error *err)
{
Dictionary opts = ARRAY_DICT_INIT;
PUT(opts, "rgb", BOOLEAN_OBJ(enable_rgb));
nvim_ui_attach(channel_id, width, height, opts, err);
api_free_dictionary(opts);
}
void nvim_ui_detach(uint64_t channel_id, Error *err)
FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(err, Exception, _("UI is not attached for channel"));
return;
}
remote_ui_disconnect(channel_id);
}
Object ui_try_resize(uint64_t channel_id, Integer width,
Integer height, Error *err)
void nvim_ui_try_resize(uint64_t channel_id, Integer width,
Integer height, Error *err)
FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(err, Exception, _("UI is not attached for channel"));
return;
}
if (width <= 0 || height <= 0) {
api_set_error(err, Validation,
_("Expected width > 0 and height > 0"));
return NIL;
return;
}
UI *ui = pmap_get(uint64_t)(connected_uis, channel_id);
ui->width = (int)width;
ui->height = (int)height;
ui_refresh();
return NIL;
}
void nvim_ui_set_option(uint64_t channel_id, String name,
Object value, Error *error)
FUNC_API_NOEVAL
{
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
api_set_error(error, Exception, _("UI is not attached for channel"));
return;
}
UI *ui = pmap_get(uint64_t)(connected_uis, channel_id);
ui_set_option(ui, name, value, error);
if (!error->set) {
ui_refresh();
}
}
static void ui_set_option(UI *ui, String name, Object value, Error *error) {
if (strcmp(name.data, "rgb") == 0) {
if (value.type != kObjectTypeBoolean) {
api_set_error(error, Validation, _("rgb must be a Boolean"));
return;
}
ui->rgb = value.data.boolean;
} else if (strcmp(name.data, "popupmenu_external") == 0) {
if (value.type != kObjectTypeBoolean) {
api_set_error(error, Validation,
_("popupmenu_external must be a Boolean"));
return;
}
ui->pum_external = value.data.boolean;
} else {
api_set_error(error, Validation, _("No such ui option"));
}
}
static void push_call(UI *ui, char *name, Array args)
@@ -341,3 +404,19 @@ static void remote_ui_set_icon(UI *ui, char *icon)
ADD(args, STRING_OBJ(cstr_to_string(icon)));
push_call(ui, "set_icon", args);
}
static void remote_ui_event(UI *ui, char *name, Array args, bool *args_consumed)
{
Array my_args = ARRAY_DICT_INIT;
// Objects are currently single-reference
// make a copy, but only if necessary
if (*args_consumed) {
for (size_t i = 0; i < args.size; i++) {
ADD(my_args, copy_object(args.items[i]));
}
} else {
my_args = args;
*args_consumed = true;
}
push_call(ui, name, my_args);
}

View File

@@ -14,6 +14,7 @@
#include "nvim/msgpack_rpc/channel.h"
#include "nvim/vim.h"
#include "nvim/buffer.h"
#include "nvim/file_search.h"
#include "nvim/window.h"
#include "nvim/types.h"
#include "nvim/ex_docmd.h"
@@ -21,7 +22,7 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/eval.h"
#include "nvim/misc2.h"
#include "nvim/option.h"
#include "nvim/syntax.h"
#include "nvim/getchar.h"
#include "nvim/os/input.h"
@@ -32,37 +33,35 @@
# include "api/vim.c.generated.h"
#endif
/// Executes an ex-mode command str
/// Executes an ex-command.
/// On VimL error: Returns the VimL error; v:errmsg is not updated.
///
/// @param str The command str
/// @param[out] err Details of an error that may have occurred
void vim_command(String str, Error *err)
/// @param command Ex-command string
/// @param[out] err Error details (including actual VimL error), if any
void nvim_command(String command, Error *err)
{
// Run the command
try_start();
do_cmdline_cmd(str.data);
do_cmdline_cmd(command.data);
update_screen(VALID);
try_end(err);
}
/// Passes input keys to Neovim
/// Passes input keys to Nvim.
/// On VimL error: Does not fail, but updates v:errmsg.
///
/// @param keys to be typed
/// @param mode specifies the mapping options
/// @param escape_csi the string needs escaping for K_SPECIAL/CSI bytes
/// @param keys to be typed
/// @param mode mapping options
/// @param escape_csi If true, escape K_SPECIAL/CSI bytes in `keys`
/// @see feedkeys()
/// @see vim_strsave_escape_csi
void vim_feedkeys(String keys, String mode, Boolean escape_csi)
void nvim_feedkeys(String keys, String mode, Boolean escape_csi)
{
bool remap = true;
bool insert = false;
bool typed = false;
bool execute = false;
if (keys.size == 0) {
return;
}
for (size_t i = 0; i < mode.size; ++i) {
switch (mode.data[i]) {
case 'n': remap = false; break;
@@ -73,6 +72,10 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
}
}
if (keys.size == 0 && !execute) {
return;
}
char *keys_esc;
if (escape_csi) {
// Need to escape K_SPECIAL and CSI before putting the string in the
@@ -92,18 +95,25 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
typebuf_was_filled = true;
}
if (execute) {
int save_msg_scroll = msg_scroll;
/* Avoid a 1 second delay when the keys start Insert mode. */
msg_scroll = false;
exec_normal(true);
msg_scroll |= save_msg_scroll;
}
}
/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a
/// lower-level input buffer and the call is not deferred.
/// This is the most reliable way to emulate real user input.
/// Passes keys to Nvim as raw user-input.
/// On VimL error: Does not fail, but updates v:errmsg.
///
/// Unlike `nvim_feedkeys`, this uses a lower-level input buffer and the call
/// is not deferred. This is the most reliable way to emulate real user input.
///
/// @param keys to be typed
/// @return The number of bytes actually written, which can be lower than
/// requested if the buffer becomes full.
Integer vim_input(String keys)
/// @return Number of bytes actually written (can be fewer than
/// requested if the buffer becomes full).
Integer nvim_input(String keys)
FUNC_API_ASYNC
{
return (Integer)input_enqueue(keys);
@@ -113,7 +123,7 @@ Integer vim_input(String keys)
///
/// @see replace_termcodes
/// @see cpoptions
String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
Boolean special)
{
if (str.size == 0) {
@@ -133,10 +143,10 @@ String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
return cstr_as_string(ptr);
}
String vim_command_output(String str, Error *err)
String nvim_command_output(String str, Error *err)
{
do_cmdline_cmd("redir => v:command_output");
vim_command(str, err);
nvim_command(str, err);
do_cmdline_cmd("redir END");
if (err->set) {
@@ -146,19 +156,19 @@ String vim_command_output(String str, Error *err)
return cstr_to_string((char *)get_vim_var_str(VV_COMMAND_OUTPUT));
}
/// Evaluates the expression str using the Vim internal expression
/// evaluator (see |expression|).
/// Dictionaries and lists are recursively expanded.
/// Evaluates a VimL expression (:help expression).
/// Dictionaries and Lists are recursively expanded.
/// On VimL error: Returns a generic error; v:errmsg is not updated.
///
/// @param str The expression str
/// @param[out] err Details of an error that may have occurred
/// @return The expanded object
Object vim_eval(String str, Error *err)
/// @param expr VimL expression string
/// @param[out] err Error details, if any
/// @return Evaluation result or expanded object
Object nvim_eval(String expr, Error *err)
{
Object rv = OBJECT_INIT;
// Evaluate the expression
try_start();
typval_T *expr_result = eval_expr((char_u *) str.data, NULL);
typval_T *expr_result = eval_expr((char_u *)expr.data, NULL);
if (!expr_result) {
api_set_error(err, Exception, _("Failed to evaluate expression"));
@@ -174,13 +184,14 @@ Object vim_eval(String str, Error *err)
return rv;
}
/// Call the given function with the given arguments stored in an array.
/// Calls a VimL function with the given arguments.
/// On VimL error: Returns a generic error; v:errmsg is not updated.
///
/// @param fname Function to call
/// @param args Functions arguments packed in an Array
/// @param[out] err Details of an error that may have occurred
/// @param fname Function to call
/// @param args Function arguments packed in an Array
/// @param[out] err Error details, if any
/// @return Result of the function call
Object vim_call_function(String fname, Array args, Error *err)
Object nvim_call_function(String fname, Array args, Error *err)
{
Object rv = OBJECT_INIT;
if (args.size > MAX_FUNC_ARGS) {
@@ -223,13 +234,13 @@ free_vim_args:
return rv;
}
/// Calculates the number of display cells `str` occupies, tab is counted as
/// one cell.
/// Calculates the number of display cells occupied by `text`.
/// <Tab> counts as one cell.
///
/// @param str Some text
/// @param[out] err Details of an error that may have occurred
/// @return The number of cells
Integer vim_strwidth(String str, Error *err)
/// @param text Some text
/// @param[out] err Error details, if any
/// @return Number of cells
Integer nvim_strwidth(String str, Error *err)
{
if (str.size > INT_MAX) {
api_set_error(err, Validation, _("String length is too high"));
@@ -239,10 +250,10 @@ Integer vim_strwidth(String str, Error *err)
return (Integer) mb_string2cells((char_u *) str.data);
}
/// Gets a list of paths contained in 'runtimepath'
/// Gets the paths contained in 'runtimepath'.
///
/// @return The list of paths
ArrayOf(String) vim_list_runtime_paths(void)
/// @return List of paths
ArrayOf(String) nvim_list_runtime_paths(void)
{
Array rv = ARRAY_DICT_INIT;
uint8_t *rtp = p_rtp;
@@ -279,11 +290,11 @@ ArrayOf(String) vim_list_runtime_paths(void)
return rv;
}
/// Changes Vim working directory
/// Changes the global working directory.
///
/// @param dir The new working directory
/// @param[out] err Details of an error that may have occurred
void vim_change_directory(String dir, Error *err)
/// @param dir Directory path
/// @param[out] err Error details, if any
void nvim_set_current_dir(String dir, Error *err)
{
if (dir.size >= MAXPATHL) {
api_set_error(err, Validation, _("Directory string is too long"));
@@ -309,127 +320,148 @@ void vim_change_directory(String dir, Error *err)
/// Gets the current line
///
/// @param[out] err Details of an error that may have occurred
/// @return The current line string
String vim_get_current_line(Error *err)
/// @param[out] err Error details, if any
/// @return Current line string
String nvim_get_current_line(Error *err)
{
return buffer_get_line(curbuf->handle, curwin->w_cursor.lnum - 1, err);
}
/// Sets the current line
///
/// @param line The line contents
/// @param[out] err Details of an error that may have occurred
void vim_set_current_line(String line, Error *err)
/// @param line Line contents
/// @param[out] err Error details, if any
void nvim_set_current_line(String line, Error *err)
{
buffer_set_line(curbuf->handle, curwin->w_cursor.lnum - 1, line, err);
}
/// Deletes the current line
///
/// @param[out] err Details of an error that may have occurred
void vim_del_current_line(Error *err)
/// @param[out] err Error details, if any
void nvim_del_current_line(Error *err)
{
buffer_del_line(curbuf->handle, curwin->w_cursor.lnum - 1, err);
}
/// Gets a global variable
/// Gets a global (g:) variable
///
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The variable value
Object vim_get_var(String name, Error *err)
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Variable value
Object nvim_get_var(String name, Error *err)
{
return dict_get_value(&globvardict, name, err);
}
/// Sets a global (g:) variable
///
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
void nvim_set_var(String name, Object value, Error *err)
{
dict_set_value(&globvardict, name, value, false, false, err);
}
/// Removes a global (g:) variable
///
/// @param name Variable name
/// @param[out] err Error details, if any
void nvim_del_var(String name, Error *err)
{
dict_set_value(&globvardict, name, NIL, true, false, err);
}
/// Sets a global variable
///
/// @param name The variable name
/// @param value The variable value
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @deprecated
///
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
/// @return Old value or nil if there was no previous value.
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
Object vim_set_var(String name, Object value, Error *err)
{
return dict_set_value(&globvardict, name, value, false, err);
return dict_set_value(&globvardict, name, value, false, true, err);
}
/// Removes a global variable
///
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @deprecated
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Old value
Object vim_del_var(String name, Error *err)
{
return dict_set_value(&globvardict, name, NIL, true, err);
return dict_set_value(&globvardict, name, NIL, true, true, err);
}
/// Gets a vim variable
/// Gets a v: variable
///
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The variable value
Object vim_get_vvar(String name, Error *err)
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Variable value
Object nvim_get_vvar(String name, Error *err)
{
return dict_get_value(&vimvardict, name, err);
}
/// Gets an option value string
///
/// @param name The option name
/// @param[out] err Details of an error that may have occurred
/// @return The option value
Object vim_get_option(String name, Error *err)
/// @param name Option name
/// @param[out] err Error details, if any
/// @return Option value
Object nvim_get_option(String name, Error *err)
{
return get_option_from(NULL, SREQ_GLOBAL, name, err);
}
/// Sets an option value
///
/// @param name The option name
/// @param value The new option value
/// @param[out] err Details of an error that may have occurred
void vim_set_option(String name, Object value, Error *err)
/// @param name Option name
/// @param value New option value
/// @param[out] err Error details, if any
void nvim_set_option(String name, Object value, Error *err)
{
set_option_to(NULL, SREQ_GLOBAL, name, value, err);
}
/// Writes a message to vim output buffer
///
/// @param str The message
void vim_out_write(String str)
/// @param str Message
void nvim_out_write(String str)
{
write_msg(str, false);
}
/// Writes a message to vim error buffer
///
/// @param str The message
void vim_err_write(String str)
/// @param str Message
void nvim_err_write(String str)
{
write_msg(str, true);
}
/// Higher level error reporting function that ensures all str contents
/// are written by sending a trailing linefeed to `vim_err_write`
/// Writes a message to vim error buffer. Appends a linefeed to ensure all
/// contents are written.
///
/// @param str The message
void vim_report_error(String str)
/// @param str Message
/// @see nvim_err_write()
void nvim_err_writeln(String str)
{
vim_err_write(str);
vim_err_write((String) {.data = "\n", .size = 1});
nvim_err_write(str);
nvim_err_write((String) { .data = "\n", .size = 1 });
}
/// Gets the current list of buffer handles
///
/// @return The number of buffers
ArrayOf(Buffer) vim_get_buffers(void)
/// @return List of buffer handles
ArrayOf(Buffer) nvim_list_bufs(void)
{
Array rv = ARRAY_DICT_INIT;
@@ -449,17 +481,17 @@ ArrayOf(Buffer) vim_get_buffers(void)
/// Gets the current buffer
///
/// @reqturn The buffer handle
Buffer vim_get_current_buffer(void)
/// @return Buffer handle
Buffer nvim_get_current_buf(void)
{
return curbuf->handle;
}
/// Sets the current buffer
///
/// @param id The buffer handle
/// @param[out] err Details of an error that may have occurred
void vim_set_current_buffer(Buffer buffer, Error *err)
/// @param id Buffer handle
/// @param[out] err Error details, if any
void nvim_set_current_buf(Buffer buffer, Error *err)
{
buf_T *buf = find_buffer_by_handle(buffer, err);
@@ -472,15 +504,15 @@ void vim_set_current_buffer(Buffer buffer, Error *err)
if (!try_end(err) && result == FAIL) {
api_set_error(err,
Exception,
_("Failed to switch to buffer %" PRIu64),
_("Failed to switch to buffer %d"),
buffer);
}
}
/// Gets the current list of window handles
///
/// @return The number of windows
ArrayOf(Window) vim_get_windows(void)
/// @return List of window handles
ArrayOf(Window) nvim_list_wins(void)
{
Array rv = ARRAY_DICT_INIT;
@@ -500,16 +532,16 @@ ArrayOf(Window) vim_get_windows(void)
/// Gets the current window
///
/// @return The window handle
Window vim_get_current_window(void)
/// @return Window handle
Window nvim_get_current_win(void)
{
return curwin->handle;
}
/// Sets the current window
///
/// @param handle The window handle
void vim_set_current_window(Window window, Error *err)
/// @param handle Window handle
void nvim_set_current_win(Window window, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -522,15 +554,15 @@ void vim_set_current_window(Window window, Error *err)
if (!try_end(err) && win != curwin) {
api_set_error(err,
Exception,
_("Failed to switch to window %" PRIu64),
_("Failed to switch to window %d"),
window);
}
}
/// Gets the current list of tabpage handles
///
/// @return The number of tab pages
ArrayOf(Tabpage) vim_get_tabpages(void)
/// @return List of tabpage handles
ArrayOf(Tabpage) nvim_list_tabpages(void)
{
Array rv = ARRAY_DICT_INIT;
@@ -548,19 +580,19 @@ ArrayOf(Tabpage) vim_get_tabpages(void)
return rv;
}
/// Gets the current tab page
/// Gets the current tabpage
///
/// @return The tab page handle
Tabpage vim_get_current_tabpage(void)
/// @return Tabpage handle
Tabpage nvim_get_current_tabpage(void)
{
return curtab->handle;
}
/// Sets the current tab page
/// Sets the current tabpage
///
/// @param handle The tab page handle
/// @param[out] err Details of an error that may have occurred
void vim_set_current_tabpage(Tabpage tabpage, Error *err)
/// @param handle Tabpage handle
/// @param[out] err Error details, if any
void nvim_set_current_tabpage(Tabpage tabpage, Error *err)
{
tabpage_T *tp = find_tab_by_handle(tabpage, err);
@@ -573,16 +605,17 @@ void vim_set_current_tabpage(Tabpage tabpage, Error *err)
if (!try_end(err) && tp != curtab) {
api_set_error(err,
Exception,
_("Failed to switch to tabpage %" PRIu64),
_("Failed to switch to tabpage %d"),
tabpage);
}
}
/// Subscribes to event broadcasts
///
/// @param channel_id The channel id (passed automatically by the dispatcher)
/// @param event The event type string
void vim_subscribe(uint64_t channel_id, String event)
/// @param channel_id Channel id (passed automatically by the dispatcher)
/// @param event Event type string
void nvim_subscribe(uint64_t channel_id, String event)
FUNC_API_NOEVAL
{
size_t length = (event.size < METHOD_MAXLEN ? event.size : METHOD_MAXLEN);
char e[METHOD_MAXLEN + 1];
@@ -593,9 +626,10 @@ void vim_subscribe(uint64_t channel_id, String event)
/// Unsubscribes to event broadcasts
///
/// @param channel_id The channel id (passed automatically by the dispatcher)
/// @param event The event type string
void vim_unsubscribe(uint64_t channel_id, String event)
/// @param channel_id Channel id (passed automatically by the dispatcher)
/// @param event Event type string
void nvim_unsubscribe(uint64_t channel_id, String event)
FUNC_API_NOEVAL
{
size_t length = (event.size < METHOD_MAXLEN ?
event.size :
@@ -606,12 +640,12 @@ void vim_unsubscribe(uint64_t channel_id, String event)
channel_unsubscribe(channel_id, e);
}
Integer vim_name_to_color(String name)
Integer nvim_get_color_by_name(String name)
{
return name_to_color((uint8_t *)name.data);
}
Dictionary vim_get_color_map(void)
Dictionary nvim_get_color_map(void)
{
Dictionary colors = ARRAY_DICT_INIT;
@@ -623,8 +657,8 @@ Dictionary vim_get_color_map(void)
}
Array vim_get_api_info(uint64_t channel_id)
FUNC_API_ASYNC
Array nvim_get_api_info(uint64_t channel_id)
FUNC_API_ASYNC FUNC_API_NOEVAL
{
Array rv = ARRAY_DICT_INIT;
@@ -635,13 +669,101 @@ Array vim_get_api_info(uint64_t channel_id)
return rv;
}
/// Call many api methods atomically
///
/// This has two main usages: Firstly, to perform several requests from an
/// async context atomically, i.e. without processing requests from other rpc
/// clients or redrawing or allowing user interaction in between. Note that api
/// methods that could fire autocommands or do event processing still might do
/// so. For instance invoking the :sleep command might call timer callbacks.
/// Secondly, it can be used to reduce rpc overhead (roundtrips) when doing
/// many requests in sequence.
///
/// @param calls an array of calls, where each call is described by an array
/// with two elements: the request name, and an array of arguments.
/// @param[out] err Details of a validation error of the nvim_multi_request call
/// itself, i e malformatted `calls` parameter. Errors from called methods will
/// be indicated in the return value, see below.
///
/// @return an array with two elements. The first is an array of return
/// values. The second is NIL if all calls succeeded. If a call resulted in
/// an error, it is a three-element array with the zero-based index of the call
/// which resulted in an error, the error type and the error message. If an
/// error ocurred, the values from all preceding calls will still be returned.
Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
FUNC_API_NOEVAL
{
Array rv = ARRAY_DICT_INIT;
Array results = ARRAY_DICT_INIT;
Error nested_error = ERROR_INIT;
size_t i; // also used for freeing the variables
for (i = 0; i < calls.size; i++) {
if (calls.items[i].type != kObjectTypeArray) {
api_set_error(err,
Validation,
_("All items in calls array must be arrays"));
goto validation_error;
}
Array call = calls.items[i].data.array;
if (call.size != 2) {
api_set_error(err,
Validation,
_("All items in calls array must be arrays of size 2"));
goto validation_error;
}
if (call.items[0].type != kObjectTypeString) {
api_set_error(err,
Validation,
_("name must be String"));
goto validation_error;
}
String name = call.items[0].data.string;
if (call.items[1].type != kObjectTypeArray) {
api_set_error(err,
Validation,
_("args must be Array"));
goto validation_error;
}
Array args = call.items[1].data.array;
MsgpackRpcRequestHandler handler = msgpack_rpc_get_handler_for(name.data,
name.size);
Object result = handler.fn(channel_id, args, &nested_error);
if (nested_error.set) {
// error handled after loop
break;
}
ADD(results, result);
}
ADD(rv, ARRAY_OBJ(results));
if (nested_error.set) {
Array errval = ARRAY_DICT_INIT;
ADD(errval, INTEGER_OBJ((Integer)i));
ADD(errval, INTEGER_OBJ(nested_error.type));
ADD(errval, STRING_OBJ(cstr_to_string(nested_error.msg)));
ADD(rv, ARRAY_OBJ(errval));
} else {
ADD(rv, NIL);
}
return rv;
validation_error:
api_free_array(results);
return rv;
}
/// Writes a message to vim output or error buffer. The string is split
/// and flushed after each newline. Incomplete lines are kept for writing
/// later.
///
/// @param message The message to write
/// @param to_err true if it should be treated as an error message (use
/// `emsg` instead of `msg` to print each line)
/// @param message Message to write
/// @param to_err true: message is an error (uses `emsg` instead of `msg`)
static void write_msg(String message, bool to_err)
{
static size_t out_pos = 0, err_pos = 0;

View File

@@ -11,15 +11,14 @@
#include "nvim/window.h"
#include "nvim/screen.h"
#include "nvim/move.h"
#include "nvim/misc2.h"
/// Gets the current buffer in a window
///
/// @param window The window handle
/// @param[out] err Details of an error that may have occurred
/// @return The buffer handle
Buffer window_get_buffer(Window window, Error *err)
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return Buffer handle
Buffer nvim_win_get_buf(Window window, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -32,10 +31,10 @@ Buffer window_get_buffer(Window window, Error *err)
/// Gets the cursor position in the window
///
/// @param window The window handle
/// @param[out] err Details of an error that may have occurred
/// @return the (row, col) tuple
ArrayOf(Integer, 2) window_get_cursor(Window window, Error *err)
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return (row, col) tuple
ArrayOf(Integer, 2) nvim_win_get_cursor(Window window, Error *err)
{
Array rv = ARRAY_DICT_INIT;
win_T *win = find_window_by_handle(window, err);
@@ -50,10 +49,10 @@ ArrayOf(Integer, 2) window_get_cursor(Window window, Error *err)
/// Sets the cursor position in the window
///
/// @param window The window handle
/// @param pos the (row, col) tuple representing the new position
/// @param[out] err Details of an error that may have occurred
void window_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
/// @param window Window handle
/// @param pos (row, col) tuple representing the new position
/// @param[out] err Error details, if any
void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -96,10 +95,10 @@ void window_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
/// Gets the window height
///
/// @param window The window handle
/// @param[out] err Details of an error that may have occurred
/// @return the height in rows
Integer window_get_height(Window window, Error *err)
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return Height as a count of rows
Integer nvim_win_get_height(Window window, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -113,10 +112,10 @@ Integer window_get_height(Window window, Error *err)
/// Sets the window height. This will only succeed if the screen is split
/// horizontally.
///
/// @param window The window handle
/// @param height the new height in rows
/// @param[out] err Details of an error that may have occurred
void window_set_height(Window window, Integer height, Error *err)
/// @param window Window handle
/// @param height Height as a count of rows
/// @param[out] err Error details, if any
void nvim_win_set_height(Window window, Integer height, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -139,10 +138,10 @@ void window_set_height(Window window, Integer height, Error *err)
/// Gets the window width
///
/// @param window The window handle
/// @param[out] err Details of an error that may have occurred
/// @return the width in columns
Integer window_get_width(Window window, Error *err)
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return Width as a count of columns
Integer nvim_win_get_width(Window window, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -156,10 +155,10 @@ Integer window_get_width(Window window, Error *err)
/// Sets the window width. This will only succeed if the screen is split
/// vertically.
///
/// @param window The window handle
/// @param width the new width in columns
/// @param[out] err Details of an error that may have occurred
void window_set_width(Window window, Integer width, Error *err)
/// @param window Window handle
/// @param width Width as a count of columns
/// @param[out] err Error details, if any
void nvim_win_set_width(Window window, Integer width, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -182,11 +181,11 @@ void window_set_width(Window window, Integer width, Error *err)
/// Gets a window-scoped (w:) variable
///
/// @param window The window handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The variable value
Object window_get_var(Window window, String name, Error *err)
/// @param window Window handle
/// @param name Variable name
/// @param[out] err Error details, if any
/// @return Variable value
Object nvim_win_get_var(Window window, String name, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -199,11 +198,46 @@ Object window_get_var(Window window, String name, Error *err)
/// Sets a window-scoped (w:) variable
///
/// @param window The window handle
/// @param name The variable name
/// @param value The variable value
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @param window Window handle
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
void nvim_win_set_var(Window window, String name, Object value, Error *err)
{
win_T *win = find_window_by_handle(window, err);
if (!win) {
return;
}
dict_set_value(win->w_vars, name, value, false, false, err);
}
/// Removes a window-scoped (w:) variable
///
/// @param window Window handle
/// @param name Variable name
/// @param[out] err Error details, if any
void nvim_win_del_var(Window window, String name, Error *err)
{
win_T *win = find_window_by_handle(window, err);
if (!win) {
return;
}
dict_set_value(win->w_vars, name, NIL, true, false, err);
}
/// Sets a window-scoped (w:) variable
///
/// @deprecated
///
/// @param window Window handle
/// @param name Variable name
/// @param value Variable value
/// @param[out] err Error details, if any
/// @return Old value or nil if there was no previous value.
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
@@ -215,18 +249,17 @@ Object window_set_var(Window window, String name, Object value, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(win->w_vars, name, value, false, err);
return dict_set_value(win->w_vars, name, value, false, true, err);
}
/// Removes a window-scoped (w:) variable
///
/// @param window The window handle
/// @param name The variable name
/// @param[out] err Details of an error that may have occurred
/// @return The old value or nil if there was no previous value.
/// @deprecated
///
/// @warning It may return nil if there was no previous value
/// or if previous value was `v:null`.
/// @param window Window handle
/// @param name variable name
/// @param[out] err Error details, if any
/// @return Old value
Object window_del_var(Window window, String name, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -235,16 +268,16 @@ Object window_del_var(Window window, String name, Error *err)
return (Object) OBJECT_INIT;
}
return dict_set_value(win->w_vars, name, NIL, true, err);
return dict_set_value(win->w_vars, name, NIL, true, true, err);
}
/// Gets a window option value
///
/// @param window The window handle
/// @param name The option name
/// @param[out] err Details of an error that may have occurred
/// @return The option value
Object window_get_option(Window window, String name, Error *err)
/// @param window Window handle
/// @param name Option name
/// @param[out] err Error details, if any
/// @return Option value
Object nvim_win_get_option(Window window, String name, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -258,11 +291,11 @@ Object window_get_option(Window window, String name, Error *err)
/// Sets a window option value. Passing 'nil' as value deletes the option(only
/// works if there's a global fallback)
///
/// @param window The window handle
/// @param name The option name
/// @param value The option value
/// @param[out] err Details of an error that may have occurred
void window_set_option(Window window, String name, Object value, Error *err)
/// @param window Window handle
/// @param name Option name
/// @param value Option value
/// @param[out] err Error details, if any
void nvim_win_set_option(Window window, String name, Object value, Error *err)
{
win_T *win = find_window_by_handle(window, err);
@@ -275,10 +308,10 @@ void window_set_option(Window window, String name, Object value, Error *err)
/// Gets the window position in display cells. First position is zero.
///
/// @param window The window handle
/// @param[out] err Details of an error that may have occurred
/// @return The (row, col) tuple with the window position
ArrayOf(Integer, 2) window_get_position(Window window, Error *err)
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return (row, col) tuple with the window position
ArrayOf(Integer, 2) nvim_win_get_position(Window window, Error *err)
{
Array rv = ARRAY_DICT_INIT;
win_T *win = find_window_by_handle(window, err);
@@ -291,12 +324,12 @@ ArrayOf(Integer, 2) window_get_position(Window window, Error *err)
return rv;
}
/// Gets the window tab page
/// Gets the window tabpage
///
/// @param window The window handle
/// @param[out] err Details of an error that may have occurred
/// @return The tab page that contains the window
Tabpage window_get_tabpage(Window window, Error *err)
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return Tabpage that contains the window
Tabpage nvim_win_get_tabpage(Window window, Error *err)
{
Tabpage rv = 0;
win_T *win = find_window_by_handle(window, err);
@@ -308,11 +341,31 @@ Tabpage window_get_tabpage(Window window, Error *err)
return rv;
}
/// Gets the window number
///
/// @param window Window handle
/// @param[out] err Error details, if any
/// @return Window number
Integer nvim_win_get_number(Window window, Error *err)
{
int rv = 0;
win_T *win = find_window_by_handle(window, err);
if (!win) {
return rv;
}
int tabnr;
win_get_tabwin(window, &tabnr, &rv);
return rv;
}
/// Checks if a window is valid
///
/// @param window The window handle
/// @param window Window handle
/// @return true if the window is valid, false otherwise
Boolean window_is_valid(Window window)
Boolean nvim_win_is_valid(Window window)
{
Error stub = ERROR_INIT;
return find_window_by_handle(window, &stub) != NULL;

View File

@@ -36,6 +36,7 @@
#include "nvim/ex_eval.h"
#include "nvim/ex_getln.h"
#include "nvim/fileio.h"
#include "nvim/file_search.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
@@ -48,7 +49,6 @@
#include "nvim/memory.h"
#include "nvim/message.h"
#include "nvim/misc1.h"
#include "nvim/misc2.h"
#include "nvim/garray.h"
#include "nvim/move.h"
#include "nvim/option.h"
@@ -268,6 +268,9 @@ open_buffer (
bool buf_valid(buf_T *buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
if (buf == NULL) {
return false;
}
FOR_ALL_BUFFERS(bp) {
if (bp == buf) {
return true;
@@ -276,30 +279,25 @@ bool buf_valid(buf_T *buf)
return false;
}
/*
* Close the link to a buffer.
* "action" is used when there is no longer a window for the buffer.
* It can be:
* 0 buffer becomes hidden
* DOBUF_UNLOAD buffer is unloaded
* DOBUF_DELETE buffer is unloaded and removed from buffer list
* DOBUF_WIPE buffer is unloaded and really deleted
* When doing all but the first one on the current buffer, the caller should
* get a new buffer very soon!
*
* The 'bufhidden' option can force freeing and deleting.
*
* When "abort_if_last" is TRUE then do not close the buffer if autocommands
* cause there to be only one window with this buffer. e.g. when ":quit" is
* supposed to close the window but autocommands close all other windows.
*/
void
close_buffer (
win_T *win, /* if not NULL, set b_last_cursor */
buf_T *buf,
int action,
int abort_if_last
)
/// Close the link to a buffer.
///
/// @param win If not NULL, set b_last_cursor.
/// @param buf
/// @param action Used when there is no longer a window for the buffer.
/// Possible values:
/// 0 buffer becomes hidden
/// DOBUF_UNLOAD buffer is unloaded
/// DOBUF_DELETE buffer is unloaded and removed from buffer list
/// DOBUF_WIPE buffer is unloaded and really deleted
/// When doing all but the first one on the current buffer, the
/// caller should get a new buffer very soon!
/// The 'bufhidden' option can force freeing and deleting.
/// @param abort_if_last
/// If TRUE, do not close the buffer if autocommands cause
/// there to be only one window with this buffer. e.g. when
/// ":quit" is supposed to close the window but autocommands
/// close all other windows.
void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
{
bool unload_buf = (action != 0);
bool del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
@@ -328,13 +326,14 @@ close_buffer (
wipe_buf = true;
}
if (win_valid(win)) {
/* Set b_last_cursor when closing the last window for the buffer.
* Remember the last cursor position and window options of the buffer.
* This used to be only for the current window, but then options like
* 'foldmethod' may be lost with a ":only" command. */
if (buf->b_nwindows == 1)
if (win_valid_any_tab(win)) {
// Set b_last_cursor when closing the last window for the buffer.
// Remember the last cursor position and window options of the buffer.
// This used to be only for the current window, but then options like
// 'foldmethod' may be lost with a ":only" command.
if (buf->b_nwindows == 1) {
set_last_cursor(win);
}
buflist_setfpos(buf, win,
win->w_cursor.lnum == 1 ? 0 : win->w_cursor.lnum,
win->w_cursor.col, TRUE);
@@ -407,7 +406,7 @@ close_buffer (
buf->b_nwindows = nwindows;
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
if (win_valid(win) && win->w_buffer == buf) {
if (win_valid_any_tab(win) && win->w_buffer == buf) {
win->w_buffer = NULL; // make sure we don't use the buffer now
}
@@ -483,17 +482,32 @@ void buf_clear_file(buf_T *buf)
buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */
}
/*
* buf_freeall() - free all things allocated for a buffer that are related to
* the file. flags:
* BFA_DEL buffer is going to be deleted
* BFA_WIPE buffer is going to be wiped out
* BFA_KEEP_UNDO do not free undo information
*/
/// Clears the current buffer contents.
void buf_clear(void)
{
linenr_T line_count = curbuf->b_ml.ml_line_count;
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
ml_delete((linenr_T)1, false);
}
deleted_lines_mark(1, line_count); // prepare for display
ml_close(curbuf, true); // free memline_T
buf_clear_file(curbuf);
}
/// buf_freeall() - free all things allocated for a buffer that are related to
/// the file. Careful: get here with "curwin" NULL when exiting.
///
/// @param flags BFA_DEL buffer is going to be deleted
/// BFA_WIPE buffer is going to be wiped out
/// BFA_KEEP_UNDO do not free undo information
void buf_freeall(buf_T *buf, int flags)
{
bool is_curbuf = (buf == curbuf);
int is_curwin = (curwin != NULL && curwin->w_buffer == buf);
win_T *the_curwin = curwin;
tabpage_T *the_curtab = curtab;
// Make sure the buffer isn't closed by autocommands.
buf->b_closing = true;
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
if (!buf_valid(buf)) /* autocommands may delete the buffer */
@@ -510,8 +524,18 @@ void buf_freeall(buf_T *buf, int flags)
return;
}
buf->b_closing = false;
if (aborting()) /* autocmds may abort script processing */
// If the buffer was in curwin and the window has changed, go back to that
// window, if it still exists. This avoids that ":edit x" triggering a
// "tabnext" BufUnload autocmd leaves a window behind without a buffer.
if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) {
block_autocmds();
goto_tabpage_win(the_curtab, the_curwin);
unblock_autocmds();
}
if (aborting()) { // autocmds may abort script processing
return;
}
/*
* It's possible that autocommands change curbuf to the one being deleted.
@@ -662,14 +686,15 @@ void handle_swap_exists(buf_T *old_curbuf)
* aborting() returns FALSE when closing a buffer. */
enter_cleanup(&cs);
/* User selected Quit at ATTENTION prompt. Go back to previous
* buffer. If that buffer is gone or the same as the current one,
* open a new, empty buffer. */
swap_exists_action = SEA_NONE; /* don't want it again */
swap_exists_did_quit = TRUE;
close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE);
if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
// User selected Quit at ATTENTION prompt. Go back to previous
// buffer. If that buffer is gone or the same as the current one,
// open a new, empty buffer.
swap_exists_action = SEA_NONE; // don't want it again
swap_exists_did_quit = true;
close_buffer(curwin, curbuf, DOBUF_UNLOAD, false);
if (!buf_valid(old_curbuf) || old_curbuf == curbuf) {
old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
}
if (old_curbuf != NULL) {
enter_buffer(old_curbuf);
if (old_tw != curbuf->b_p_tw)
@@ -1310,28 +1335,29 @@ void do_autochdir(void)
}
}
/*
* functions for dealing with the buffer list
*/
//
// functions for dealing with the buffer list
//
/*
* Add a file name to the buffer list. Return a pointer to the buffer.
* If the same file name already exists return a pointer to that buffer.
* If it does not exist, or if fname == NULL, a new entry is created.
* If (flags & BLN_CURBUF) is TRUE, may use current buffer.
* If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list.
* If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer.
* This is the ONLY way to create a new buffer.
*/
static int top_file_num = 1; /* highest file number */
static int top_file_num = 1; ///< highest file number
buf_T *
buflist_new (
char_u *ffname, /* full path of fname or relative */
char_u *sfname, /* short fname or NULL */
linenr_T lnum, /* preferred cursor line */
int flags /* BLN_ defines */
)
/// Add a file name to the buffer list.
/// If the same file name already exists return a pointer to that buffer.
/// If it does not exist, or if fname == NULL, a new entry is created.
/// If (flags & BLN_CURBUF) is TRUE, may use current buffer.
/// If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list.
/// If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer.
/// If (flags & BLN_NEW) is TRUE, don't use an existing buffer.
/// This is the ONLY way to create a new buffer.
///
/// @param ffname full path of fname or relative
/// @param sfname short fname or NULL
/// @param lnum preferred cursor line
/// @param flags BLN_ defines
/// @param bufnr
///
/// @return pointer to the buffer
buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags)
{
buf_T *buf;
@@ -1397,8 +1423,7 @@ buflist_new (
}
if (buf != curbuf || curbuf == NULL) {
buf = xcalloc(1, sizeof(buf_T));
handle_register_buffer(buf);
/* init b: variables */
// init b: variables
buf->b_vars = dict_alloc();
init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
}
@@ -1451,11 +1476,12 @@ buflist_new (
lastbuf = buf;
buf->b_fnum = top_file_num++;
if (top_file_num < 0) { /* wrap around (may cause duplicates) */
handle_register_buffer(buf);
if (top_file_num < 0) { // wrap around (may cause duplicates)
EMSG(_("W14: Warning: List of file names overflow"));
if (emsg_silent == 0) {
ui_flush();
os_delay(3000L, true); /* make sure it is noticed */
os_delay(3000L, true); // make sure it is noticed
}
top_file_num = 1;
}
@@ -2365,10 +2391,11 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
{
buf_T *buf;
/* Create a buffer. 'buflisted' is not set if it's a new buffer */
// Create a buffer. 'buflisted' is not set if it's a new buffer
buf = buflist_new(ffname, sfname, lnum, 0);
if (buf != NULL && !cmdmod.keepalt)
if (buf != NULL && !cmdmod.keepalt) {
curwin->w_alt_fnum = buf->b_fnum;
}
return buf;
}
@@ -2403,8 +2430,9 @@ int buflist_add(char_u *fname, int flags)
buf_T *buf;
buf = buflist_new(fname, NULL, (linenr_T)0, flags);
if (buf != NULL)
if (buf != NULL) {
return buf->b_fnum;
}
return 0;
}
@@ -4514,7 +4542,7 @@ chk_modeline (
char_u *e;
char_u *linecopy; /* local copy of any modeline found */
int prev;
int vers;
intmax_t vers;
int end;
int retval = OK;
char_u *save_sourcing_name;
@@ -4533,7 +4561,10 @@ chk_modeline (
e = s + 4;
else
e = s + 3;
vers = getdigits_int(&e);
if (getdigits_safe(&e, &vers) != OK) {
continue;
}
if (*e == ':'
&& (s[0] != 'V'
|| STRNCMP(skipwhite(e + 1), "set", 3) == 0)
@@ -4541,8 +4572,9 @@ chk_modeline (
|| (VIM_VERSION_100 >= vers && isdigit(s[3]))
|| (VIM_VERSION_100 < vers && s[3] == '<')
|| (VIM_VERSION_100 > vers && s[3] == '>')
|| (VIM_VERSION_100 == vers && s[3] == '=')))
|| (VIM_VERSION_100 == vers && s[3] == '='))) {
break;
}
}
}
prev = *s;
@@ -5231,12 +5263,30 @@ wipe_buffer (
int aucmd /* When TRUE trigger autocommands. */
)
{
if (buf->b_fnum == top_file_num - 1)
--top_file_num;
if (!aucmd) /* Don't trigger BufDelete autocommands here. */
if (!aucmd) {
// Don't trigger BufDelete autocommands here.
block_autocmds();
close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
if (!aucmd)
}
close_buffer(NULL, buf, DOBUF_WIPE, false);
if (!aucmd) {
unblock_autocmds();
}
}
/// Creates or switches to a scratch buffer. :h special-buffers
/// Scratch buffer is:
/// - buftype=nofile bufhidden=hide noswapfile
/// - Always considered 'nomodified'
///
/// @param bufnr Buffer to switch to, or 0 to create a new buffer.
///
/// @see curbufIsChanged()
void buf_open_scratch(handle_T bufnr, char *bufname)
{
(void)do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)bufname, NULL, true);
set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
RESET_BINDING(curwin);
}

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