Compare commits

...

169 Commits

Author SHA1 Message Date
bfredl
7e194f0d0c NVIM 0.10.1
This is a maintenance release.

FEATURES
--------------------------------------------------------------------------------
- ebc6c38cde lsp: update LSP healthcheck format (#28988)

BUILD
--------------------------------------------------------------------------------
- ba90b54301 deps: drop unused bundled bash, python parsers and queries
- 803cc08c17 deps: bump tree-sitter-c to v0.21.3
- 91e337a477 deps: bump tree-sitter-query to v0.4.0
- 978b63a9f1 deps: bump tree-sitter-vimdoc to v3.0.0
- b322c3560b "popcount" name conflict on NetBSD #28983
- b397b5672c remove -O2 from gen_cflags
- f77db12995 reuse code for deps.txt for both deps and main build
- 46d2906332 macos: disable deduplication in link step

FIXES
--------------------------------------------------------------------------------
- 70f7708cdf assert failure in VimL expression parser
- 28f03205be show swapfile warning as a warning (#28972)
- 0d293e4315 api: alloc and draw cursor window in nvim__redraw
- e1b6187801 colorscheme: underline StatusLineNC with 'notermguicolors' #28810
- aa1321801d column: clamp line number for legacy signs
- df6ce8377f column: crash with 'signcolumn' set to "number" (#29003)
- 97be9d8563 column: modifying a sign should update placed signs (#29750)
- 21b21b94e6 comment: fall back to using trimmed comment markers (#28950)
- 0827279ff5 defaults: default @/Q broken when 'ignorecase' is set (#29343)
- 5d9f2d7ecc drawline: don't draw beyond end of window (#29035)
- eadc4e03a2 drawline: don't draw beyond end of window with 'rnu' (#29406)
- bec397edda extmarks: issues with revalidating marks #28961
- 1fe1f8556e filetype: fix typos in filetype detection
- ad55ec350c float: handle error in win_float_create() (#29742)
- bf16fe3f01 fs: make vim.fs.root work for relative paths and unnamed buffers (#28973)
- 5eaae797af health: broken ruby detect #28804
- 24ee2e7c74 health: fix fetching url with python in provider health (#29594)
- 7582d4a7b5 input: handle vim.on_key() properly with ALT and K_SPECIAL (#29677)
- 4f0c4c3921 lsp: add textDocument/documentLink to capability map (#28838)
- 2d7aab623e lsp: avoid vim.keymap.del error when stopping a client (#29478)
- bdd5871dc5 lsp: check if buffer was detached in on_init callback (#28942)
- d8ff216040 lsp: clear lsp client diagnostics (#29091)
- 3a727beafd lsp: detach all clients on_reload to force buf_state reload (#28898)
- e98637e8c0 lsp: do not detach from buffer if there are uninitialized clients (#29043)
- 0ee3147bc7 lsp: do not reset buf version when detaching client (#29273)
- 24fa65a500 lsp: don't show codelens for buffers that don't support it (#29690)
- 4efca7cda5 lsp: handle nil root_dir in health check (#29010)
- efe8a0a520 lsp: hide layout in codelenses in virtual text (#28794) (#28895)
- 2fb69ccaf7 lsp: inlay hints are rendered in the correct order (#29707)
- dfff482efe lsp: remove superfluous on_detach callback from semantic tokens module (#29188)
- 10a16c1311 lsp: trigger LspDetach on buffer delete
- 33121f1eae lua: change some vim.fn.expand() to vim.fs.normalize() (#29583)
- ffc457a1dc marks: revalidate marks whose position did not change
- f82d7b8200 mouse: early return when clicking in padded 'statuscolumn' (#29394)
- d6756fc0a5 move: half-page scrolling with resized grid at eob (#28821)
- 0cf7e2570c path: avoid chdir() when resolving path (#28799)
- 63ff7338ea quickfix: make shortmess+=O work with cmdheight=0 (#29609)
- 46c2962b3a runtime: add commentstring for glsl ftplugin
- b98aa783f3 runtime: source c ftplugin properly for cpp on Windows (#29053)
- 039121f5a3 snippet: cancel snippet session when leaving the buffer (#29044)
- 84d7bfcf16 snippet: don't override unnamed register on tabstop select (#29008)
- e13f03af85 snippet: modify base indentation when there's actually whitespace (#29670)
- 9fd6664ba7 tohtml: extmark text may be out of bounds
- 8c88f402e1 tohtml: ignore lsp inlay hints
- 5cdf0c22bd tohtml: properly handle multiple hl groups #29012
- 3d319092d5 tohtml: replace ipairs with pairs
- 4150e5e6fd tohtml: show how many warnings are hidden
- 0389472961 tohtml: support ranges again
- ab2d243fd0 treesitter: display fields for anonymous nodes in :InspectTree
- 35f6425207 treesitter: do not modify highlight state for _on_spell_nav
- 356ddb1305 treesitter: ensure syntaxset augroup exists (#29542)
- eb53aba5af treesitter: recognize aliased parsers in omnifunc, query linter
- b6b2272573 tui: move $COLORTERM check to _defaults.lua (#29206)
- 89f29fcc92 tui: remove duplicate disabling of synchronized output (#28884)
- a784b901be tui: skip TUI in ui_rgb_attached (#29096)
- 19787d6057 ui: avoid ambiguity about last chunk when flushing halfway (#29718)
- 89fa1ee822 ui: flush ext_cmdline events before doing cmdpreview (#29062)
- 7055cd1238 ui: superfluous showmode / excessive grid_cursor_goto #29089
- 6802db7aa1 version: fix vim.version().prerelease
- 728f6c7c83 vim.text: remove assert from vim.text.hexdecode
- c3aef56199 win-msi: add bin to PATH per-machine after installation (#29099)

VIM PATCHES
--------------------------------------------------------------------------------
- fdf769fa86 0b74eec: runtime(stylus): remove remaining css code (vim/vim#14866)
- 29fd7432fd 74703f1: runtime(doc): remove obsolete Ex insert behavior (#29702)
- 891cc78179 7a85e34: runtime(doc): fix inconsistencies in :h file-searching (#29652)
- 704d33634e 8.2.0083: text properties wrong when tabs and spaces are exchanged
- 571e54e12c 8.2.0109: corrupted text properties when expanding spaces
- 7c055bd74b 8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../' (#29667)
- 9c91233a38 9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'
- 34cc49bd72 9.1.0498: getcmdcompltype() interferes with cmdline completion (#29397)
- 259a620eb8 9.1.0512: Mode message for spell completion doesn't match allowed keys (#29437)
- f89d4ee6ce 9.1.0526: Unwanted cursor movement with pagescroll at start of buffer (#29569)
- 4ce293c2c3 9.1.0565: Stop directory doesn't work properly in 'tags'
- c467bfeb93 9.1.0566: Stop dir in findfile() doesn't work properly w/o trailing slash
- 576363a0fb 9.1.0567: Cannot use relative paths as findfile() stop directories
- ceb82a9396 9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)
- 07de890de6 9.1.0580: :lmap mapping for keypad key not applied when typed in Select mode (#29693)
- b01202df15 9.1.0594: Unnecessary redraw when setting 'winfixbuf' (#29775)
- 804a94d300 9.1.0601: Wrong cursor position with 'breakindent' when wide char doesn't fit (#29793)
- a03cc83bfb df62c62: runtime(doc): grammar fixes in options.txt (#29729)
- fde5718e62 partial:9.0.0323: using common name in tests leads to flaky tests

REDACTOR
--------------------------------------------------------------------------------
- c35e040b7e replace deprecated vim.loop with vim.uv
- 3a354bfcaa lsp: reuse buf_detach_client logic in on_detach (#28939) (#29024)
- dffadc392e path.c: add nonnull attributes (#28829)
- db65017e60 tests: more global highlight definitions
- 3725db69ef tests: use more global highlight definitions

CI
--------------------------------------------------------------------------------
- 7400f9dfe5 adjust workflows to enable required checks
- 575136c178 always add `target:release` label when backporting
- 410f43c0ae bump backport action to version 3
- 9a2760a01f change label `backport` to `target:release`
- b94b341ef2 run workflows on release branches
- 0e81c62405 skip lintcommit workflow on release branches

TESTING
--------------------------------------------------------------------------------
- f03348472d add a test for #29119
- 18a36d3d9f do not set termguicolors in test runner
- 68513c2a89 fix reporting "no flush received" too early (#29735)
- 981548b7f7 remove checks for failed tests on Windows
- 65776124b1 starting and stopping treesitter highlight (#29546)

DOCUMENTATION
--------------------------------------------------------------------------------
- 891b235df0 document 'list' behavior when 'listchars' excludes "tab" (#29360)
- 8c00651131 fix more treesitter parsing errors
- 777e15fa61 update LSP quickstart (#28989)
- 6136326d63 lpeg: merge upstream changes
- f7d8650616 lsp: format the handwritten part #29295
2024-07-24 09:20:05 +02:00
Rustum Zia
70f7708cdf fix: assert failure in VimL expression parser
(cherry picked from commit 6720bd440f)
2024-07-21 16:49:52 +02:00
Luuk van Baal
0d293e4315 fix(api): alloc and draw cursor window in nvim__redraw
Problem:  Unable to move cursor to recently opened window.
Solution: Make sure uninitialized window is drawn before trying to move
          the cursor to it.
(cherry picked from commit 89f9f168a5)
2024-07-21 16:37:50 +02:00
Luuk van Baal
ffc457a1dc fix(marks): revalidate marks whose position did not change
Problem:  Marks whose position did not change with the action that
          invalidated them (right_gravity = false) are not revalidated
          upon undo.
Solution: Remove early return when restoring a marks saved position so
          that it is still revalidated. Add "move" guards instead.
(cherry picked from commit 012db2b0f5)
2024-07-21 16:31:33 +02:00
dundargoc
575136c178 ci: always add target:release label when backporting
Previously the label was not added if the backport PR was created
manually. The new code is also easier to maintain as it's close to other
label-related code.

(cherry picked from commit 4c788b1757)
2024-07-21 16:03:10 +02:00
dundargoc
f77db12995 build: reuse code for deps.txt for both deps and main build
(cherry picked from commit f09f5c45fa)
2024-07-21 14:56:57 +02:00
zeertzjq
18a9ae169e Merge pull request #29797 from neovim/backport-29793-to-release-0.10
vim-patch:9.1.0601: Wrong cursor position with 'breakindent' when wide char doesn't fit
2024-07-19 12:14:33 +08:00
zeertzjq
804a94d300 vim-patch:9.1.0601: Wrong cursor position with 'breakindent' when wide char doesn't fit (#29793)
Problem:  Wrong cursor position with 'breakindent' when a double-width
          character doesn't fit in a screen line (mikoto2000)
Solution: Include the width of the 'breakindent' properly.
          (zeertzjq)

fixes: vim/vim#15289
closes: vim/vim#15290

b5d6b5caac
(cherry picked from commit 35b35cb93c)
2024-07-19 03:55:46 +00:00
altermo
0389472961 fix(tohtml): support ranges again 2024-07-18 09:44:52 +02:00
altermo
9fd6664ba7 fix(tohtml): extmark text may be out of bounds 2024-07-18 09:44:52 +02:00
Riley Bruins
5cdf0c22bd fix(tohtml): properly handle multiple hl groups #29012
Problem: :TOhtml doesn't properly handle virtual text when it has
multiple highlight groups. It also improperly calculates position offset
for multi-byte virt_text characters.

Solution: Apply the `vim.api.nvim_strwidth` broadly to properly
calculate character offset, and handle the cases where the `hl` argument
can be a table of multiple hl groups.
2024-07-18 09:44:52 +02:00
altermo
4150e5e6fd fix(tohtml): show how many warnings are hidden 2024-07-18 09:44:52 +02:00
altermo
8c88f402e1 fix(tohtml): ignore lsp inlay hints 2024-07-18 09:44:52 +02:00
altermo
3d319092d5 fix(tohtml): replace ipairs with pairs 2024-07-18 09:44:52 +02:00
zeertzjq
6527f5e2d2 Merge pull request #29783 from neovim/backport-29742-to-release-0.10
fix(winfloat): error handle in float create
2024-07-18 13:24:09 +08:00
glepnir
ad55ec350c fix(float): handle error in win_float_create() (#29742)
Problem: Missing error handling in win_float_create() function.
Solution: Add an inline function for error handling.
(cherry picked from commit 8ddcf9d939)
2024-07-18 05:00:31 +00:00
zeertzjq
125b253e7b Merge pull request #29782 from neovim/backport-29775-to-release-0.10
vim-patch:9.1.0594: Unnecessary redraw when setting 'winfixbuf'
2024-07-18 12:46:13 +08:00
zeertzjq
b01202df15 vim-patch:9.1.0594: Unnecessary redraw when setting 'winfixbuf' (#29775)
Problem:  Unnecessary redraw when setting 'winfixbuf'.
Solution: Remove P_RWIN flag. (zeertzjq)

closes: vim/vim#15283

ac4ce9e15b
(cherry picked from commit bbe51ef016)
2024-07-18 04:26:17 +00:00
zeertzjq
d6437e2ca5 Merge pull request #29781 from neovim/backport-29750-to-release-0.10
fix(column): modifying a sign should update placed signs
2024-07-18 12:24:10 +08:00
luukvbaal
97be9d8563 fix(column): modifying a sign should update placed signs (#29750)
Problem:  Modifying a sign no longer updates already placed signs.
Solution: Loop over (newly-exposed) placed decorations when modifying a
          sign definition. Update placed decor if it belongs to the sign
          that is modified.
(cherry picked from commit f9a49fab0c)
2024-07-18 04:09:26 +00:00
Amit Singh
2fb69ccaf7 fix(lsp): inlay hints are rendered in the correct order (#29707)
Problem:
When there are multiple inlay hints present at the same position, they
should be rendered in the order they are received in the response from
LSP as per the LSP spec. Currently, this is not respected.

Solution:
Gather all hints for a given position, and then set it in a single
extmark call instead of multiple set_extmark calls. This leads to fewer
extmark calls and correct inlay hints being rendered.
2024-07-17 17:56:04 +02:00
dundargoc
0e81c62405 ci: skip lintcommit workflow on release branches
Since lintcommit is a required check, it will always need to be run.
However, the lintcommit script is not designed to work on PRs that
doesn't target master branch (and it's not clear whether it's even
desirable).

To circumvent this we create a "dummy" lintcommit check that is run on
release branches that always passes, thus fulfilling the condition of
the required check.

(cherry picked from commit 0500804df5)
2024-07-17 17:29:18 +02:00
zeertzjq
68513c2a89 test: fix reporting "no flush received" too early (#29735)
(cherry picked from commit bc2bd25f8e)
2024-07-17 23:06:02 +08:00
Riley Bruins
eb53aba5af fix(treesitter): recognize aliased parsers in omnifunc, query linter
**Problem:** A query file for something like `html_tags` will not be
given html node completion

**Solution:** Check for parser aliases before offering completions

Co-authored-by: Lewis Russell <me@lewisr.dev>
(cherry picked from commit 05dcda8f9b)
2024-07-17 12:37:42 +02:00
Maria José Solano
e13f03af85 fix(snippet): modify base indentation when there's actually whitespace (#29670)
(cherry picked from commit 5fe4ce6678)
2024-07-17 11:42:03 +02:00
Riley Bruins
24fa65a500 fix(lsp): don't show codelens for buffers that don't support it (#29690)
(cherry picked from commit 1f2f460b4a)
2024-07-17 11:41:53 +02:00
dundargoc
b94b341ef2 ci: run workflows on release branches
Github doesn't allow workflows to be run from the `github-actions`
account, which is the default account. This caused the CI on backport
PRs to not be run. The way to circumvent this is to use a token that
essentially "pretends" to be another user, which in turn triggers the CI
as desired.

Also run lintcommit on release branches as that is now a required check,
meaning it must always be run.
2024-07-16 20:12:13 +02:00
dundargoc
410f43c0ae ci: bump backport action to version 3 2024-07-16 20:12:13 +02:00
zeertzjq
677eb23c38 Merge pull request #29731 from neovim/backport-29729-to-release-0.10
vim-patch:df62c62: runtime(doc): grammar fixes in options.txt
2024-07-16 06:47:16 +08:00
zeertzjq
a03cc83bfb vim-patch:df62c62: runtime(doc): grammar fixes in options.txt (#29729)
closes: vim/vim#15265

df62c62177

Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
(cherry picked from commit c2b51e6c41)
2024-07-15 22:32:55 +00:00
zeertzjq
a333847f6b Merge pull request #29730 from neovim/backport-29727-to-release-0.10
docs(lpeg): merge upstream changes
2024-07-16 06:30:15 +08:00
Maria José Solano
6136326d63 docs(lpeg): merge upstream changes
(cherry picked from commit 8703e7bd12)
2024-07-15 22:16:53 +00:00
dundargoc
7400f9dfe5 ci: adjust workflows to enable required checks
Auto-merging is a useful feature by github, but it requires required
checks which requires a few adjustments. The primary change is that
required checks can't use `paths` or `paths-ignore` as that risks not
running the job, and required checks must always be run.

A workaround for this is to introduce a dummy workflow which is used for
every path not used in the real workflow. That way the required job is
"always" run as far as github is concerned. The workaround is unweildly
so it's only useful to do it for costly workflows where the potential
benefits are big. If not it's better to simply remove any `paths` or
`paths-ignore` from a workflow instead.

(cherry picked from commit 3c803483ac)
2024-07-15 18:16:57 +02:00
zeertzjq
2ae8bb7b96 Merge pull request #29720 from neovim/backport-29718-to-release-0.10
fix(ui): avoid ambiguity about last chunk when flushing halfway
2024-07-15 18:49:07 +08:00
zeertzjq
19787d6057 fix(ui): avoid ambiguity about last chunk when flushing halfway (#29718)
(cherry picked from commit 594c7f3d77)
2024-07-15 10:35:38 +00:00
github-actions[bot]
f654a30093 docs: misc (#29714)
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: dundargoc <33953936+dundargoc@users.noreply.github.com>
2024-07-15 07:09:47 +08:00
github-actions[bot]
29fd7432fd vim-patch:74703f1: runtime(doc): remove obsolete Ex insert behavior (#29702)
related: vim/vim#15120
closes: vim/vim#15228

74703f1086

Nvim only supports Vim Ex mode, so this is long obsolete in Nvim.

Co-authored-by: Mohamed Akram <mohd.akram@outlook.com>
2024-07-14 15:08:13 +08:00
zeertzjq
b2587a0665 Merge pull request #29701 from neovim/backport-29652-to-release-0.10
vim-patch:7a85e34: runtime(doc): fix inconsistencies in :h file-searching
2024-07-14 15:02:51 +08:00
zeertzjq
891cc78179 vim-patch:7a85e34: runtime(doc): fix inconsistencies in :h file-searching (#29652)
closes: vim/vim#15201

7a85e343d2
(cherry picked from commit 15f6cf0c8f)
2024-07-14 06:46:36 +00:00
zeertzjq
94aacc2695 Merge pull request #29700 from neovim/backport-29673-to-release-0.10
vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently
2024-07-14 14:45:36 +08:00
zeertzjq
ceb82a9396 vim-patch:9.1.0569: fnamemodify() treats ".." and "../" differently (#29673)
Problem:  fnamemodify() treats ".." and "../" differently.
Solution: Expand ".." properly like how "/.." is treated in 8.2.3388.
          (zeertzjq)

closes: vim/vim#15218

1ee7420460
(cherry picked from commit 028dd3c5c4)
2024-07-14 06:33:01 +00:00
zeertzjq
bddbbd874c Merge pull request #29699 from neovim/backport-29668-to-release-0.10
vim-patch:9.1.{0562,0565,0566,0567}: file search fixes
2024-07-14 14:31:02 +08:00
zeertzjq
576363a0fb vim-patch:9.1.0567: Cannot use relative paths as findfile() stop directories
Problem:  Cannot use relative paths as findfile() stop directories.
Solution: Change a relative path to an absolute path.
          (zeertzjq)

related: vim/vim#15200
closes: vim/vim#15202

764526e279
(cherry picked from commit 80818641f3)
2024-07-14 06:14:50 +00:00
zeertzjq
c467bfeb93 vim-patch:9.1.0566: Stop dir in findfile() doesn't work properly w/o trailing slash
Problem:  Stop directory in findfile() doesn't work properly without a
          trailing slash.
Solution: Always use fnamencmp(), not fnamecmp().

related: vim/vim#15200
related: vim/vim#15202

e6ab23bd4a
(cherry picked from commit 091a130804)
2024-07-14 06:14:50 +00:00
zeertzjq
4ce293c2c3 vim-patch:9.1.0565: Stop directory doesn't work properly in 'tags'
Problem:  Stop directory doesn't work properly in 'tags'.
          (Jesse Pavel)
Solution: Also move the stop directory forward by one byte.
          (zeertzjq)

This doesn't support relative stop directories yet, as they are not
supported in other places like findfile() either.

fixes: vim/vim#15200
related: vim/vim#15202

68819afb2c
(cherry picked from commit 50feb85b0c)
2024-07-14 06:14:50 +00:00
zeertzjq
fde5718e62 vim-patch:partial:9.0.0323: using common name in tests leads to flaky tests
Problem:    Using common name in tests leads to flaky tests.
Solution:   Rename files and directories to be more specific.

3b0d70f4ff

This only includes test_findfile.vim changes.

vim-patch:9.1.0562: tests: inconsistency in test_findfile.vim

Problem:  tests: inconsistency in test_findfile.vim, it saves and
          restores 'shellslash', but doesn't actually set it
Solution: Set shellslash explicitly (zeertzjq)

closes: vim/vim#15217

e7b98ab96e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 2c9e82e193)
2024-07-14 06:14:50 +00:00
zeertzjq
a430944ea7 Merge pull request #29698 from neovim/backport-29667-to-release-0.10
vim-patch:8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../'
2024-07-14 14:12:30 +08:00
zeertzjq
7c055bd74b vim-patch:8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../' (#29667)
Problem:    fnamemodify('path/..', ':p') differs from using 'path/../'.
Solution:   Include the "/.." in the directory name. (closes vim/vim#8808)

4eaef9979f

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 31d53cbb0f)
2024-07-14 05:59:59 +00:00
zeertzjq
113e5a91de Merge pull request #29694 from neovim/backport-29693-to-release-0.10
vim-patch:9.1.0580: :lmap mapping for keypad key not applied when typed in Select mode
2024-07-14 07:09:29 +08:00
zeertzjq
07de890de6 vim-patch:9.1.0580: :lmap mapping for keypad key not applied when typed in Select mode (#29693)
Problem:  An :lmap mapping for a printable keypad key is not applied
          when typing it in Select mode.
Solution: Change keypad key to ASCII after setting vgetc_char.
          (zeertzjq)

closes: vim/vim#15245

90a800274d
(cherry picked from commit 49ba36becd)
2024-07-13 22:53:52 +00:00
zeertzjq
ae9aa58f9c Merge pull request #29679 from neovim/backport-29677-to-release-0.10
fix(input): handle vim.on_key() properly with ALT and K_SPECIAL
2024-07-13 04:38:07 +08:00
zeertzjq
7582d4a7b5 fix(input): handle vim.on_key() properly with ALT and K_SPECIAL (#29677)
(cherry picked from commit 16f63b964f)
2024-07-12 20:14:45 +00:00
Christian Clason
8c00651131 docs: fix more treesitter parsing errors 2024-07-09 16:13:26 +02:00
Christian Clason
ba90b54301 build(deps): drop unused bundled bash, python parsers and queries
Problem: Neovim bundles treesitter parsers for bash and python but does
not use them by default. This dilutes the messaging about the bundled
parsers being required for functionality or reasonable out-of-the-box
experience. It also increases the risk of query incompatibilities for no
gain.

Solution: Stop bundling bash and python parser and queries.
(cherry picked from commit 51d85f7ea5)
2024-07-09 16:13:26 +02:00
Christian Clason
46d2906332 build(macos): disable deduplication in link step
Problem: Apple Clang 16 comes with a new deduplication algorithm that is
enabled by default in release builds (https://developer.apple.com/documentation/xcode-release-notes/xcode-16-release-notes#New-Features-in-Xcode-16-Beta) which breaks the built
nvim binary (locks and spins at 100% CPU).

Solution: Disable deduplication on macOS. Tested on Clang 15 as well and
seems to make no difference to binary size anyway.

(cherry picked from commit 7e099cf3eb)
2024-07-09 14:29:59 +02:00
Christian Clason
978b63a9f1 build(deps): bump tree-sitter-vimdoc to v3.0.0 2024-07-09 13:49:12 +02:00
zeertzjq
cb9ccedf04 Merge pull request #29625 from zeertzjq/backport
Backport to release-0.10
2024-07-09 19:45:31 +08:00
zeertzjq
33121f1eae fix(lua): change some vim.fn.expand() to vim.fs.normalize() (#29583)
Unlike vim.fn.expand(), vim.fs.normalize() doesn't expand wildcards.
2024-07-09 19:27:10 +08:00
Stanislav Asunkin
24ee2e7c74 fix(health): fix fetching url with python in provider health (#29594) 2024-07-09 19:25:27 +08:00
zeertzjq
8fe17036ba Merge pull request #29610 from neovim/backport-29609-to-release-0.10
fix(quickfix): make shortmess+=O work with cmdheight=0
2024-07-08 10:51:38 +08:00
zeertzjq
63ff7338ea fix(quickfix): make shortmess+=O work with cmdheight=0 (#29609)
(cherry picked from commit 73ae7d44a2)
2024-07-08 02:36:58 +00:00
zeertzjq
f39fb4c11e Merge pull request #29600 from neovim/backport-29599-to-release-0.10
build: remove -O2 from gen_cflags
2024-07-08 06:14:55 +08:00
Lewis Russell
b397b5672c build: remove -O2 from gen_cflags
Problem:
zig cc implicitly defines NDEBUG with -O2. This breaks debug builds
which does not include -O2 or NDEBUG.

Solution:
Do not add -O2 when generating header files.

(cherry picked from commit e5ff302033)
2024-07-07 18:59:09 +00:00
zeertzjq
bc1e168e49 Merge pull request #29595 from neovim/backport-28966-to-release-0.10
refactor: replace deprecated vim.loop with vim.uv
2024-07-07 16:54:16 +08:00
dundargoc
c35e040b7e refactor: replace deprecated vim.loop with vim.uv
(cherry picked from commit 1a2e6ebc59)
2024-07-07 08:41:56 +00:00
Riley Bruins
ab2d243fd0 fix(treesitter): display fields for anonymous nodes in :InspectTree
(cherry picked from commit 9217e0d671)
2024-07-05 10:15:14 +02:00
zeertzjq
5cad641848 Merge pull request #29570 from neovim/backport-29569-to-release-0.10
vim-patch:9.1.0526: Unwanted cursor movement with pagescroll at start of buffer
2024-07-05 08:14:39 +08:00
luukvbaal
f89d4ee6ce vim-patch:9.1.0526: Unwanted cursor movement with pagescroll at start of buffer (#29569)
Problem:  Cursor is moved to bottom of window trying to pagescroll when
          already at the start of the buffer (Asheq Imran, after v9.1.0357)
Solution: Don't move cursor when buffer content did not move.
          (Luuk van Baal)

8ccb89016e
(cherry picked from commit 3e6cec0bef)
2024-07-04 23:51:51 +00:00
zeertzjq
d6a73d7314 Merge pull request #29551 from neovim/backport-29478-to-release-0.10
fix(lsp): :LspStop vim.keymap.del error
2024-07-04 05:36:27 +08:00
Matt Fellenz
2d7aab623e fix(lsp): avoid vim.keymap.del error when stopping a client (#29478)
(cherry picked from commit fc9b70826e)
2024-07-03 20:59:14 +00:00
zeertzjq
28a5923aea Merge pull request #29547 from neovim/backport-29546-to-release-0.10
test: starting and stopping treesitter highlight
2024-07-03 09:25:07 +08:00
zeertzjq
65776124b1 test: starting and stopping treesitter highlight (#29546)
(cherry picked from commit 599fc7cee4)
2024-07-03 00:41:10 +00:00
zeertzjq
2845d05569 Merge pull request #29545 from neovim/backport-29542-to-release-0.10
fix(treesitter): ensure syntaxset augroup exists
2024-07-03 07:56:32 +08:00
zeertzjq
356ddb1305 fix(treesitter): ensure syntaxset augroup exists (#29542)
Problem:
Error when calling vim.treesitter.start() and vim.treesitter.stop() in
init.lua.

Solution:
Ensure syntaxset augroup exists after loading synload.vim.

(cherry picked from commit d413038b4f)
2024-07-02 23:40:57 +00:00
Christian Clason
803cc08c17 build(deps): bump tree-sitter-c to v0.21.3
(cherry picked from commit 98536dd78e)
2024-06-25 10:04:44 +02:00
Christian Clason
91e337a477 build(deps): bump tree-sitter-query to v0.4.0
(cherry picked from commit 61b3a26e5b)
2024-06-25 10:04:44 +02:00
zeertzjq
f76d0dc91e Merge pull request #29469 from neovim/backport-29460-to-release-0.10
fix(treesitter): do not modify highlight state for _on_spell_nav
2024-06-24 20:03:36 +08:00
Luuk van Baal
35f6425207 fix(treesitter): do not modify highlight state for _on_spell_nav
Problem:  Treesitter highlighter clears the already populated highlight
          state when performing spell checking while drawing a
          smoothscrolled topline.
Solution: Save and restore the highlight state in the highlighter's
          _on_spell_nav callback.
(cherry picked from commit da4e8dc5b0)
2024-06-24 11:40:30 +00:00
zeertzjq
9c6efd0a65 Merge pull request #29438 from neovim/backport-29437-to-release-0.10
vim-patch:9.1.0512: Mode message for spell completion doesn't match allowed keys
2024-06-21 14:53:22 +08:00
zeertzjq
259a620eb8 vim-patch:9.1.0512: Mode message for spell completion doesn't match allowed keys (#29437)
Problem:  Mode message for spell completion doesn't match allowed keys
          (Kyle Kovacs)
Solution: Show "^S" instead of "s".
          (zeertzjq)

This matches the code in vim_is_ctrl_x_key():

	case CTRL_X_SPELL:
	    return (c == Ctrl_S || c == Ctrl_P || c == Ctrl_N);

fixes: neovim/neovim#29431
closes: vim/vim#15065

7002c055d5
(cherry picked from commit 1db1476fd9)
2024-06-21 06:40:43 +00:00
zeertzjq
3b8d0721af Merge pull request #29407 from neovim/backport-29406-to-release-0.10
fix(drawline): don't draw beyond end of window with 'rnu'
2024-06-19 09:33:17 +08:00
zeertzjq
eadc4e03a2 fix(drawline): don't draw beyond end of window with 'rnu' (#29406)
(cherry picked from commit b1c439cef6)
2024-06-19 01:20:42 +00:00
zeertzjq
17fe405adc Merge pull request #29399 from neovim/backport-29394-to-release-0.10
fix(mouse): early return when clicking in padded 'statuscolumn'
2024-06-19 06:16:50 +08:00
luukvbaal
f82d7b8200 fix(mouse): early return when clicking in padded 'statuscolumn' (#29394)
Problem:  Hit assert when clicking inside a padded 'statuscolumn' that
          is padded beyond the length of the allocated click_defs.
Solution: Still consider this a "in_statuscol" click, but return early
          when about to execute the click func.
(cherry picked from commit 102971a396)
2024-06-18 22:03:11 +00:00
zeertzjq
b16fe558ae Merge pull request #29398 from neovim/backport-29397-to-release-0.10
vim-patch:9.1.0498: getcmdcompltype() interferes with cmdline completion
2024-06-19 06:00:15 +08:00
zeertzjq
34cc49bd72 vim-patch:9.1.0498: getcmdcompltype() interferes with cmdline completion (#29397)
Problem:  getcmdcompltype() interferes with cmdline completion.
Solution: Don't set expand context when it's already set.
          (zeertzjq)

closes: vim/vim#15036

a821b609f9
(cherry picked from commit 4e8ec4900e)
2024-06-18 21:47:42 +00:00
zeertzjq
ad82e11eb7 Merge pull request #29386 from neovim/backport-29014-to-release-0.10
refactor(tests): more global highlight definitions
2024-06-18 10:33:17 +08:00
bfredl
db65017e60 refactor(tests): more global highlight definitions
(cherry picked from commit b90d7c36cf)
2024-06-18 02:18:49 +00:00
zeertzjq
2eafe248c4 Merge pull request #29385 from neovim/backport-29006-to-release-0.10
refactor(tests): use more global highlight definitions
2024-06-18 10:10:39 +08:00
bfredl
3725db69ef refactor(tests): use more global highlight definitions
(cherry picked from commit fb43741f80)
2024-06-18 01:52:58 +00:00
zeertzjq
9f2aec2629 Merge pull request #29383 from neovim/backport-29295-to-release-0.10
docs(lsp): format the handwritten part
2024-06-18 07:25:30 +08:00
Yi Ming
f7d8650616 docs(lsp): format the handwritten part #29295
(cherry picked from commit 7ce261c064)
2024-06-17 23:06:15 +00:00
zeertzjq
446b05f85a Merge pull request #29362 from neovim/backport-29360-to-release-0.10
docs: document 'list' behavior when 'listchars' excludes "tab"
2024-06-16 06:25:05 +08:00
zeertzjq
891b235df0 docs: document 'list' behavior when 'listchars' excludes "tab" (#29360)
(cherry picked from commit 7e65f3757b)
2024-06-15 22:11:15 +00:00
zeertzjq
1ab52dff9a Merge pull request #29346 from neovim/backport-29343-to-release-0.10
fix(defaults): default @/Q broken when 'ignorecase' is set
2024-06-15 10:51:36 +08:00
Jerry
0827279ff5 fix(defaults): default @/Q broken when 'ignorecase' is set (#29343)
Problem:
When 'ignorecase' is set, the default keymap Q and Q would exit visual
mode.

This issue was raised in #28287 and a fix was applied in #28289.

However, `==` operator is subject to user `ignorecase` setting.

Solution:
Switching to `==#` operator would guarantee case sensitive comparison
between visual mode and linewise visual mode.

Co-authored-by: Kuanju Chen <kuanju.chen@mksinst.com>
(cherry picked from commit 61aabe0730)
2024-06-15 02:21:35 +00:00
zeertzjq
77b0970cda Merge pull request #29342 from neovim/backport-29229-to-release-0.10
docs: misc
2024-06-15 07:24:26 +08:00
dundargoc
643d6af451 docs: misc (#29229)
Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
Co-authored-by: Jose Pedro Oliveira <jose.p.oliveira.oss@gmail.com>
Co-authored-by: Maria José Solano <majosolano99@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
(cherry picked from commit 6e28589e00)
2024-06-14 23:06:11 +00:00
zeertzjq
4d9114d3ab Merge pull request #29309 from neovim/backport-29096-to-release-0.10
fix(tui): skip TUI in ui_rgb_attached
2024-06-13 11:13:24 +08:00
Gregory Anders
a784b901be fix(tui): skip TUI in ui_rgb_attached (#29096)
The ui_rgb_attached function determines if any UI is attached which
supports RGB (truecolor). We determine if the TUI supports RGB via the
'termguicolors' option which is checked at the beginning of this
function. If the TUI does not support RGB ('termguicolors' is unset), we
check to see if any _other_ UI is attached which supports RGB.

Normally, the TUI's "rgb" flag and the 'termguicolors' option are the
same. However, they may differ during startup when the "rgb" flag is set
by tui/tui.c to indicate to the core that the terminal emulator supports
truecolor. The 'termguicolors' option is not actually set until
_defaults.lua runs.

(cherry picked from commit 0231265c8c)
2024-06-13 01:27:14 +00:00
zeertzjq
0608444447 Merge pull request #29308 from neovim/backport-29103-to-release-0.10
test: do not set termguicolors in test runner
2024-06-13 09:25:42 +08:00
Gregory Anders
981548b7f7 test: remove checks for failed tests on Windows
(cherry picked from commit 5493fcd52f)
2024-06-13 01:09:49 +00:00
Gregory Anders
728f6c7c83 fix(vim.text): remove assert from vim.text.hexdecode
Instead, return nil plus an error message if the input is invalid.

(cherry picked from commit 4cff418564)
2024-06-13 01:09:49 +00:00
Gregory Anders
18a36d3d9f test: do not set termguicolors in test runner
It's not clear why this is needed and it has adverse side effects on
other tests.

(cherry picked from commit d24f3d055a)
2024-06-13 01:09:49 +00:00
zeertzjq
8a8c3ed4dc Merge pull request #29279 from luukvbaal/backport-29272-to-release-0.10
fix(column): clamp line number for legacy signs
2024-06-12 10:19:20 +08:00
Luuk van Baal
aa1321801d fix(column): clamp line number for legacy signs
Problem:  Legacy :sign API still allows placing signs beyond the end of
          the buffer. This is unaccounted for by the signcolumn tracking
          logic and is disallowed in general for the extmark API which
          implements it now.
Solution: Clamp legacy sign line number to the length of the buffer.
(cherry picked from commit 1dcda86559
extmark_set() namespace scope and screen test reverse sign order conflict)
2024-06-11 11:02:16 +02:00
github-actions[bot]
0ee3147bc7 fix(lsp): do not reset buf version when detaching client (#29273)
(cherry picked from commit 37bf4c572a)

Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
2024-06-10 22:22:26 +02:00
Samuel Born
46c2962b3a fix(runtime): add commentstring for glsl ftplugin
(cherry picked from commit b6c1ce8a95)
2024-06-09 14:56:21 +02:00
github-actions[bot]
b6b2272573 fix(tui): move $COLORTERM check to _defaults.lua (#29206)
fix(tui): move $COLORTERM check to _defaults.lua (#29197)

We currently check $COLORTERM in the TUI process to determine if the
terminal supports 24 bit color (truecolor). If $COLORTERM is "truecolor"
or "24bit" then we automatically assume that the terminal supports
truecolor, but if $COLORTERM is set to any other value we still query
the terminal.

The `rgb` flag of the UI struct is a boolean which only indicates
whether the UI supports truecolor, but does not have a 3rd state that we
can use to represent "we don't know if the UI supports truecolor". We
currently use `rgb=false` to represent this "we don't know" state, and
we use XTGETTCAP and DECRQSS queries to determine at runtime if the
terminal supports truecolor. However, if $COLORTERM is set to a value
besides "truecolor" or "24bit" (e.g. "256" or "16) that is a clear
indication that the terminal _does not_ support truecolor, so it is
incorrect to treat `rgb=false` as "we don't know" in that case.

Instead, in the TUI process we only check for the terminfo capabilities.
This must be done in the TUI process because we do not have access to
this information in the core Neovim process when `_defaults.lua` runs.
If the TUI cannot determine truecolor support from terminfo alone, we
set `rgb=false` to indicate "we don't know if the terminal supports
truecolor yet, keep checking". When we get to `_defaults.lua`, we can
then check $COLORTERM and only query the terminal if it is unset.

This means that users can explicitly opt out of truecolor determination
by setting `COLORTERM=256` (or similar) in their environment.

(cherry picked from commit d7651b27d5)

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2024-06-05 08:52:48 -05:00
github-actions[bot]
dfff482efe fix(lsp): remove superfluous on_detach callback from semantic tokens module (#29188)
LspDetach is now triggered by the main on_detach callback that is added
when an LSP client is attached to a buffer. The semantic_tokens module
already includes a LspDetach handler that does the right thing. When the
LspDetach trigger was added to the main LSP on_detach, it created a race
condition in semantic tokens when a buffer was deleted that would
trigger both its own on_detach and the LspDetach handlers. If the former
came last, an error was thrown trying to delete a non-existent augroup
(destroy() was being called twice).

(cherry picked from commit 43581011e4)

Co-authored-by: jdrouhard <john@drouhard.dev>
2024-06-04 19:00:51 +02:00
zeertzjq
8dece36427 Merge pull request #29187 from neovim/backport-29089-to-release-0.10
fix(ui): superfluous showmode due to unset globals
2024-06-04 21:48:57 +08:00
luukvbaal
7055cd1238 fix(ui): superfluous showmode / excessive grid_cursor_goto #29089
Problem:  Unsetting global variables earlier in #28578 to avoid
          recursiveness, caused superfluous or even unlimited
          showmode().
Solution: Partly revert #28578 so that the globals are unset at the end
          of showmode(), and avoid recursiveness for ext UI by adding a
          recursive function guard to each generated UI call that may
          call a Lua callback.
(cherry picked from commit b66106a46c)
2024-06-04 13:10:45 +00:00
zeertzjq
f1fba12803 Merge pull request #29182 from neovim/backport-29181-to-release-0.10
fix(filetype): fix typos in filetype detection
2024-06-04 17:39:29 +08:00
Evgeni Chasnovski
1fe1f8556e fix(filetype): fix typos in filetype detection
(cherry picked from commit aa9f21ee95)
2024-06-04 09:26:54 +00:00
zeertzjq
94d8f6bde8 Merge pull request #29139 from neovim/backport-29136-to-release-0.10
vim-patch:8.2.{0083,0109}
2024-06-02 15:50:32 +08:00
zeertzjq
f03348472d test: add a test for #29119
(cherry picked from commit 56337310ef)
2024-06-02 07:37:27 +00:00
zeertzjq
571e54e12c vim-patch:8.2.0109: corrupted text properties when expanding spaces
Problem:    Corrupted text properties when expanding spaces.
Solution:   Reallocate the line. (Nobuhiro Takasaki, closes vim/vim#5457)

ac15fd8c67

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 97d9d71bf3)
2024-06-02 07:37:27 +00:00
zeertzjq
704d33634e vim-patch:8.2.0083: text properties wrong when tabs and spaces are exchanged
Problem:    Text properties wrong when tabs and spaces are exchanged.
Solution:   Take text properties into account. (Nobuhiro Takasaki,
            closes vim/vim#5427)

5cb0b93d52

Co-authored-by: Bram Moolenaar <Bram@vim.org>
(cherry picked from commit 4374ec83cd)
2024-06-02 07:37:27 +00:00
zeertzjq
4c53b9c0a1 Merge pull request #29125 from neovim/backport-29003-to-release-0.10
fix(column): crash with 'signcolumn' set to "number"
2024-06-01 18:29:23 +08:00
luukvbaal
df6ce8377f fix(column): crash with 'signcolumn' set to "number" (#29003)
Problem:  Numberwidth may depend on number of signs with text in the
          buffer and is not handled correctly for extmark signs.
Solution: Move legacy sign code for changed numberwidth so that it is
          handled properly for legacy and extmark signs alike.
(cherry picked from commit f2083bd55c)
2024-06-01 10:10:52 +00:00
zeertzjq
58e1ef2f65 Merge pull request #29105 from neovim/backport-29099-to-release-0.10
fix(win-msi): add bin to PATH per-machine after installation
2024-05-31 13:39:38 +08:00
Luis Calle
c3aef56199 fix(win-msi): add bin to PATH per-machine after installation (#29099)
#22856 made it possible for the msi installer to perform per-user
installations, which caused problems for users that already had
per-machine installations trying to update (the Windows Installer does
not support major upgrades across installation context, see #22933 and
https://stackoverflow.com/a/15498911). It was then reverted in #22949,
but the scope of the modification to the PATH environment variable was
not reverted.

(cherry picked from commit a18652ed61)
2024-05-31 04:45:46 +00:00
github-actions[bot]
d8ff216040 fix(lsp): clear lsp client diagnostics (#29091)
Problem: When an lsp client is stopped, the client will
only clear the diagnostics for the attached buffers but
not the unattached buffers.
Solution: Reset the diagnostics for the whole namespace rather than
for only the attached buffers.

(cherry picked from commit 025c874415)

Co-authored-by: crwebb85 <51029315+crwebb85@users.noreply.github.com>
2024-05-30 09:23:04 +02:00
github-actions[bot]
89fa1ee822 fix(ui): flush ext_cmdline events before doing cmdpreview (#29062)
Problem:  Unable to update the screen for external cmdline during cmdpreview.
Solution: Flush the cmdline UI before cmdpreview state.
(cherry picked from commit 5b6477be45)

Co-authored-by: luukvbaal <luukvbaal@gmail.com>
2024-05-28 03:06:20 -07:00
zeertzjq
88cd7a6cdd Merge pull request #29058 from neovim/backport-29057-to-release-0.10
vim-patch:0b74eec: runtime(stylus): remove remaining css code (vim/vim#14866)
2024-05-28 15:15:24 +08:00
zeertzjq
fdf769fa86 vim-patch:0b74eec: runtime(stylus): remove remaining css code (vim/vim#14866)
This seems to be a forgotten fixup in 2d919d2744 (r141568461)

0b74eeceb8
(cherry picked from commit 4e2c8dc374)
2024-05-28 07:00:03 +00:00
zeertzjq
b36458b363 Merge pull request #29054 from neovim/backport-29053-to-release-0.10
fix(runtime): source c ftplugin properly for cpp on Windows
2024-05-28 06:51:36 +08:00
zeertzjq
b98aa783f3 fix(runtime): source c ftplugin properly for cpp on Windows (#29053)
On Windows, '{' is currently not treated as a wildcard char, so another
wildcard char is needed for the pattern to be treated as a wildcard.

It may be worth trying to make '{' always a wildcard char in the future,
but that'll be a bit harder as it'll be necessary to make sure '{' is
escaped at various places.

(cherry picked from commit 7b16c1fa84)
2024-05-27 22:39:22 +00:00
github-actions[bot]
039121f5a3 fix(snippet): cancel snippet session when leaving the buffer (#29044)
(cherry picked from commit 608543f8a9)

Co-authored-by: Maria José Solano <majosolano99@gmail.com>
2024-05-27 17:56:05 +02:00
github-actions[bot]
e98637e8c0 fix(lsp): do not detach from buffer if there are uninitialized clients (#29043)
Problem: if on_lines is called before the LSP is initialized, the buffer
is detached.
Solution: check for uninitialized clients before detaching.

(cherry picked from commit 292365fa1b)

Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
2024-05-27 17:26:42 +02:00
zeertzjq
b9e540cc70 Merge pull request #29038 from neovim/backport-28983-to-release-0.10
fix: "popcount" name conflict on NetBSD
2024-05-27 19:28:31 +08:00
Malte Dehling
b322c3560b build: "popcount" name conflict on NetBSD #28983
Problem:
    NetBSD's libc already has a function by the same name.

Solution:
    Rename popcount to xpopcount and add #if defined(__NetBSD__) to
prefer NetBSD's own implementation.  This fixes #28983.

(cherry picked from commit 104800ce2e)
2024-05-27 11:15:13 +00:00
zeertzjq
8d1467ce9a Merge pull request #29036 from neovim/backport-29035-to-release-0.10
fix(drawline): don't draw beyond end of window
2024-05-27 14:51:14 +08:00
zeertzjq
5d9f2d7ecc fix(drawline): don't draw beyond end of window (#29035)
(cherry picked from commit 9a0239fdc8)
2024-05-27 06:37:38 +00:00
zeertzjq
565fccbeeb Merge pull request #29027 from neovim/backport-28961-to-release-0.10
fix(extmarks): issues with revalidating marks
2024-05-27 05:36:25 +08:00
Mathias Fußenegger
3a354bfcaa refactor(lsp): reuse buf_detach_client logic in on_detach (#28939) (#29024)
(cherry picked from commit 2908f71dc9)
2024-05-26 20:47:59 +02:00
luukvbaal
bec397edda fix(extmarks): issues with revalidating marks #28961
Problem:  Invalid marks appear to be revalidated multiple times, and
          decor is added at the old position for unpaired marks.
Solution: Avoid revalidating already valid marks, and don't use old
          position to add to decor for unpaired marks.
(cherry picked from commit 43a2019f09)
2024-05-26 17:56:50 +00:00
github-actions[bot]
4efca7cda5 fix(lsp): handle nil root_dir in health check (#29010)
fix(lsp): handle nil root_dir in health check (#29007)

The root directory could show up as something like:

    Root directory: ~/path/to/cwd/v:null

Despite being `nil`

(cherry picked from commit f03b1622ad)

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2024-05-25 17:30:27 -05:00
github-actions[bot]
84d7bfcf16 fix(snippet): don't override unnamed register on tabstop select (#29008)
(cherry picked from commit 7994fdba6a)

Co-authored-by: Mathias Fußenegger <mfussenegger@users.noreply.github.com>
2024-05-25 22:05:23 +02:00
github-actions[bot]
777e15fa61 docs: update LSP quickstart (#28989)
docs: update LSP quickstart (#28954)

The LSP quickstart can act as our true "entrypoint" for answering the
question "How do I use LSP in Neovim?" As such, it can be a little more
beginniner-friendly than other sections of our help docs by including
explanatory comments and a more fleshed out example (including a
`FileType` autocommand).

This also includes some other minor wording updates and points users
toward `:checkhealth lsp`.

(cherry picked from commit 28c04948a1)

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2024-05-24 18:47:36 -05:00
github-actions[bot]
ebc6c38cde feat(lsp): update LSP healthcheck format (#28988)
feat(lsp): update LSP healthcheck format (#28980)

This is mostly an aesthetic change, although there are a few new pieces
of information included. Originally I wanted to investigate including
server capabilities in the healthcheck, but until we have the ability to
fold/unfold text in health checks that would be too much information.

(cherry picked from commit 5d26934c7c)

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2024-05-24 18:47:13 -05:00
github-actions[bot]
bf16fe3f01 fix(fs): make vim.fs.root work for relative paths and unnamed buffers (#28973)
If a buffer does not have a backing file then fall back to the current
working directory.

(cherry picked from commit 206f8f24a2)
2024-05-24 10:57:21 -05:00
github-actions[bot]
28f03205be fix: show swapfile warning as a warning (#28972)
The new default SwapExists autocommand displays warning text (W325) but
does not use the WarningMsg highlight group as other warnings do. Use
the WARN log level when displaying this warning.

(cherry picked from commit e71713ba2b)
2024-05-24 10:48:07 -05:00
zeertzjq
7e878da7dd Merge pull request #28953 from neovim/backport-28810-to-release-0.10
fix(colorscheme): update `StatusLineNC` to have underline with 'notgc'
2024-05-24 05:42:46 +08:00
github-actions[bot]
21b21b94e6 fix(comment): fall back to using trimmed comment markers (#28950)
fix(comment): fall back to using trimmed comment markers (#28938)

Problem: Currently comment detection, addition, and removal are done
  by matching 'commentstring' exactly. This has the downside when users
  want to add comment markers with space (like with `-- %s`
  commentstring) but also be able to uncomment lines that do not contain
  space (like `--aaa`).

Solution: Use the following approach:
  - Line is commented if it matches 'commentstring' with trimmed parts.
  - Adding comment is 100% relying on 'commentstring' parts (as is now).
  - Removing comment is first trying exact 'commentstring' parts with
    fallback on trying its trimmed parts.
(cherry picked from commit 0a2218f965)

Co-authored-by: Evgeni Chasnovski <evgeni.chasnovski@gmail.com>
2024-05-23 16:02:13 -05:00
Evgeni Chasnovski
e1b6187801 fix(colorscheme): underline StatusLineNC with 'notermguicolors' #28810
Problem: statusline for non-active window can be hard to distinguish
  from normal text with 'notermguicolors'. It was set to use only bold
  text to find a balance between being not too similar to active
  statusline and normal text, and be supported in enough terminal
  emulators (if it does not support 'termguicolors' there is higher
  chance that it also does not support underline).

Solution: reconsider balance by placing more emphasis on making
  non-active statusline more distinguishable.
  This also results into tabline being shown with underline which
  aligns with "make more distinguishable" shift.
(cherry picked from commit 9b9f54e2c1)
2024-05-23 21:01:15 +00:00
github-actions[bot]
bdd5871dc5 fix(lsp): check if buffer was detached in on_init callback (#28942)
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
(cherry picked from commit af200c10cf)

Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
2024-05-23 16:27:27 +02:00
github-actions[bot]
10a16c1311 fix(lsp): trigger LspDetach on buffer delete
Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
(cherry picked from commit 5ac8db10f0)

Co-authored-by: Andre Toerien <49614525+AThePeanut4@users.noreply.github.com>
2024-05-23 13:30:39 +02:00
github-actions[bot]
3a727beafd fix(lsp): detach all clients on_reload to force buf_state reload (#28898)
Problem:  The changetracking state can de-sync when reloading a buffer
          with more than one LSP client attached.
Solution: Fully detach all clients from the buffer to force buf_state to
          be re-created.
(cherry picked from commit 879d17ea8d)

Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
2024-05-21 20:18:48 +02:00
github-actions[bot]
efe8a0a520 fix(lsp): hide layout in codelenses in virtual text (#28794) (#28895)
Problem: layout i.e. whitespace that is part of codelenses is currently
displayed as weird symbols and large amounts of spaces

Solution: replace all consecutive whitespace symbols with a single space
character when trying to display codelenses as virtual text

(cherry picked from commit d9a2acdab3)

Co-authored-by: Mango The Fourth <40720523+MangoIV@users.noreply.github.com>
2024-05-21 18:41:55 +02:00
Ilia Choly
4f0c4c3921 fix(lsp): add textDocument/documentLink to capability map (#28838)
(cherry picked from commit 8263ed4670)
2024-05-21 18:41:22 +02:00
zeertzjq
4e9864147a Merge pull request #28891 from neovim/backport-28884-to-release-0.10
fix(tui): remove duplicate disabling of synchronized output
2024-05-21 21:09:05 +08:00
zeertzjq
89f29fcc92 fix(tui): remove duplicate disabling of synchronized output (#28884)
Synchronized output is enabled and disabled inside flush_buf().

(cherry picked from commit 47c741e30c)
2024-05-21 12:54:38 +00:00
zeertzjq
671073e714 Merge pull request #28842 from neovim/backport-28829-to-release-0.10
refactor(path.c): add nonnull attributes
2024-05-19 05:59:54 +08:00
zeertzjq
dffadc392e refactor(path.c): add nonnull attributes (#28829)
This possibly fixes the coverity warning.

(cherry picked from commit 63e3a63d2f)
2024-05-18 21:38:49 +00:00
zeertzjq
1e62f8e15c Merge pull request #28833 from neovim/backport-28831-to-release-0.10
vim-patch:94043780196c
2024-05-18 16:17:11 +08:00
zeertzjq
8e239ed9ea vim-patch:94043780196c (#28831)
runtime(matchparen): fix :NoMatchParen not working (vim/vim#14797)

fixes: neovim/neovim#28828

9404378019
(cherry picked from commit 48c2ad5d2d)
2024-05-18 07:53:42 +00:00
zeertzjq
6a1c0e9574 Merge pull request #28823 from neovim/backport-28821-to-release-0.10
fix(move): half-page scrolling with resized grid at eob
2024-05-18 07:13:47 +08:00
zeertzjq
d6756fc0a5 fix(move): half-page scrolling with resized grid at eob (#28821)
(cherry picked from commit 5947f249f8)
2024-05-17 23:00:44 +00:00
zeertzjq
c6ebb931d9 Merge pull request #28820 from neovim/backport-28790-to-release-0.10
vim-patch:9.1.{0414,0416}
2024-05-18 06:35:24 +08:00
Luuk van Baal
9c91233a38 vim-patch:9.1.0414: Unable to leave long line with 'smoothscroll' and 'scrolloff'
Problem:  Unable to leave long line with 'smoothscroll' and 'scrolloff'.
          Corrupted screen near the end of a long line with 'scrolloff'.
          (Ernie Rael, after 9.1.0280)
Solution: Only correct cursor in case scroll_cursor_bot() was not itself
          called to make the cursor visible. Avoid adjusting for
          'scrolloff' beyond the text line height (Luuk van Baal)

b32055e504

vim-patch:9.1.0416: some screen dump tests can be improved

Problem:  some screen dump tests can be improved (after 9.1.0414)
Solution: Make sure screen state changes properly and is captured in the
          screen dumps (Luuk van Baal)

2e642734f4
(cherry picked from commit f178b8ba49)
2024-05-17 22:14:03 +00:00
zeertzjq
81560bbdbf Merge pull request #28814 from neovim/backport-28804-to-release-0.10
fix(health): incorrect checkhealth of ruby
2024-05-18 05:44:16 +08:00
dundargoc
9a2760a01f ci: change label backport to target:release
`backport` is too similar `ci:backport release-x.y` and causes
confusion.
2024-05-17 22:52:56 +02:00
MoonFruit
5eaae797af fix(health): broken ruby detect #28804
(cherry picked from commit 10f9173519)
2024-05-17 15:58:56 +00:00
zeertzjq
ea6b2b78bd Merge pull request #28808 from neovim/backport-28799-to-release-0.10
fix(path): avoid chdir() when resolving path
2024-05-17 18:52:38 +08:00
zeertzjq
0cf7e2570c fix(path): avoid chdir() when resolving path (#28799)
Use uv_fs_realpath() instead.

It seems that uv_fs_realpath() has some problems on non-Linux platforms:
- macOS and other BSDs: this function will fail with UV_ELOOP if more
  than 32 symlinks are found while resolving the given path.  This limit
  is hardcoded and cannot be sidestepped.
- Windows: while this function works in the common case, there are a
  number of corner cases where it doesn't:
  - Paths in ramdisk volumes created by tools which sidestep the Volume
    Manager (such as ImDisk) cannot be resolved.
  - Inconsistent casing when using drive letters.
  - Resolved path bypasses subst'd drives.

Ref: https://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_realpath

I don't know if the old implementation that uses uv_chdir() and uv_cwd()
also suffers from the same problems.
- For the ELOOP case, chdir() seems to have the same limitations.
- On Windows, Vim doesn't use anything like chdir() either. It uses
  _wfullpath(), while libuv uses GetFinalPathNameByHandleW().

(cherry picked from commit 42aa69b076)
2024-05-17 10:39:17 +00:00
zeertzjq
902980edb9 Merge pull request #28787 from neovim/backport-28785-to-release-0.10
fix(version): fix vim.version().prerelease
2024-05-17 06:26:52 +08:00
bfredl
6802db7aa1 fix(version): fix vim.version().prerelease
fixes #28782 (when backported)

(cherry picked from commit d049752e45)
2024-05-16 20:04:20 +00:00
bfredl
d90ee70897 version bump 2024-05-16 20:17:00 +02:00
165 changed files with 3068 additions and 2508 deletions

View File

@@ -12,25 +12,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.BACKPORT_APP }}
private-key: ${{ secrets.BACKPORT_KEY }}
- name: Create backport PR
id: backport
uses: korthout/backport-action@v2
uses: korthout/backport-action@v3
with:
pull_title: "${pull_title}"
label_pattern: "^ci:backport ([^ ]+)$"
# https://github.com/korthout/backport-action/pull/399
experimental: >
{
"detect_merge_method": true
}
- if: ${{steps.backport.outputs.was_successful == 'true'}}
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: ${{steps.backport.outputs.created_pull_numbers}},
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['backport']
})
github_token: ${{ steps.app-token.outputs.token }}

33
.github/workflows/build_dummy.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: build_dummy
on:
pull_request:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
# This needs to be an exact complement of `paths` in the build.yml workflow.
# This is required to bypass required checks since a required job is always
# needed to run.
paths-ignore:
- '**.cmake'
- '**/CMakeLists.txt'
- '**/CMakePresets.json'
- 'cmake.*/**'
- '.github/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
old-cmake:
name: Test oldest supported cmake
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- run: echo "success"
use-existing-src:
name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
runs-on: ubuntu-latest
steps:
- run: echo "success"

View File

@@ -2,13 +2,6 @@ name: docs
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/nvim/api/*.[ch]'
- 'src/nvim/eval.lua'
- 'runtime/lua/**.lua'
- 'runtime/doc/**'
- 'scripts/gen_vimdoc.py'
- 'scripts/gen_help_html.lua'
jobs:
docs:
runs-on: ubuntu-latest

View File

@@ -33,8 +33,25 @@ jobs:
- name: "Extract if the PR is a breaking change and add it as label"
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true
request-reviewer:
target-release:
needs: ["changed-files", "type-scope"]
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- if: startsWith(github.base_ref, 'release')
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['target:release']
})
request-reviewer:
needs: ["changed-files", "type-scope", "target-release"]
permissions:
pull-requests: write
uses: ./.github/workflows/reviewers_add.yml

View File

@@ -1,4 +1,4 @@
name: "lintcommit"
name: lintcommit
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

16
.github/workflows/lintcommit_dummy.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
# Dummy workflow of lintcommit.yml. lintcommit is a required check, but it's
# only designed to work on master. Since required checks are always required to
# run, we can essentially "skip" the lintcommit on release branches with this
# dummy check that automatically passes.
name: lintcommit_dummy
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- 'release-[0-9]+.[0-9]+'
jobs:
lint-commits:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- run: echo "success"

View File

@@ -8,8 +8,6 @@ on:
branches:
- 'master'
- 'release-[0-9]+.[0-9]+'
paths-ignore:
- 'contrib/**'
workflow_dispatch:
concurrency:
@@ -95,18 +93,23 @@ jobs:
- run: cmake --build build --target clang-analyzer
posix:
name: ${{ matrix.build.runner }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
name: ${{ matrix.build.os }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
strategy:
fail-fast: false
matrix:
# The `os` field is not needed to differentiate between the different
# matrix builds. It is needed to not change the required checks (which
# uses jobs names) each time we bump the runner version. It may be
# possible to remove if we e.g. start using `-latest` runner versions
# or if github introduces a wildcard for required checks in the future.
build:
[
{ runner: ubuntu-22.04, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
{ runner: ubuntu-22.04, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
{ runner: ubuntu-22.04, cc: gcc },
{ runner: macos-12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: macos-14, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: ubuntu-22.04, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
{ runner: ubuntu-22.04, os: ubuntu, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
{ runner: ubuntu-22.04, os: ubuntu, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
{ runner: ubuntu-22.04, os: ubuntu, cc: gcc },
{ runner: macos-12, os: macos, flavor: 12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: macos-14, os: macos, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
{ runner: ubuntu-22.04, os: ubuntu, flavor: puc-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
]
test: [unittest, functionaltest, oldtest]
exclude:

View File

@@ -240,7 +240,7 @@ cmake --build build
### How to build without "bundled" dependencies
1. Manually install the dependencies:
- libuv libluv libvterm luajit lua-lpeg lua-mpack msgpack-c tree-sitter tree-sitter-bash tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-python tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium
- libuv libluv libvterm luajit lua-lpeg lua-mpack msgpack-c tree-sitter tree-sitter-c tree-sitter-lua tree-sitter-markdown tree-sitter-query tree-sitter-vim tree-sitter-vimdoc unibilium
2. Run CMake:
```sh
cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=RelWithDebInfo

View File

@@ -39,6 +39,12 @@ include(InstallHelpers)
include(PreventInTreeBuilds)
include(Util)
#-------------------------------------------------------------------------------
# User settings
#-------------------------------------------------------------------------------
set(DEPS_IGNORE_SHA FALSE)
#-------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------
@@ -47,9 +53,6 @@ set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches)
file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
set_directory_properties(PROPERTIES
EP_PREFIX "${DEPS_BUILD_DIR}")
if(NOT CI_BUILD)
set(CMAKE_INSTALL_MESSAGE NEVER)
endif()
@@ -142,7 +145,7 @@ endif()
# version string, else they are combined with the result of `git describe`.
set(NVIM_VERSION_MAJOR 0)
set(NVIM_VERSION_MINOR 10)
set(NVIM_VERSION_PATCH 0)
set(NVIM_VERSION_PATCH 1)
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
# API level
@@ -241,7 +244,7 @@ add_glob_target(
GLOB_DIRS runtime scripts src test
GLOB_PAT *.lua
TOUCH_STRATEGY PER_DIR)
add_dependencies(lintlua-luacheck lua-dev-deps)
add_dependencies(lintlua-luacheck lua_dev_deps)
add_glob_target(
TARGET lintlua-stylua
@@ -300,26 +303,24 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(cmake.packaging)
endif()
get_externalproject_options(uncrustify ${DEPS_IGNORE_SHA})
ExternalProject_Add(uncrustify
URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.79.0.tar.gz
URL_HASH SHA256=e7afaeabf636b7f0ce4e3e9747b95f7bd939613a8db49579755dddf44fedca5f
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/uncrustify
CMAKE_ARGS ${DEPS_CMAKE_ARGS}
EXCLUDE_FROM_ALL TRUE
DOWNLOAD_NO_PROGRESS TRUE)
${EXTERNALPROJECT_OPTIONS})
option(USE_BUNDLED_BUSTED "Use bundled busted" ON)
if(USE_BUNDLED_BUSTED)
ExternalProject_Add(lua-dev-deps
URL https://github.com/neovim/deps/raw/5a1f71cceb24990a0b15fd9a472a5f549f019248/opt/lua-dev-deps.tar.gz
URL_HASH SHA256=27db2495f5eddc7fc191701ec9b291486853530c6125609d3197d03481e8d5a2
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua-dev-deps
get_externalproject_options(lua_dev_deps ${DEPS_IGNORE_SHA})
ExternalProject_Add(lua_dev_deps
DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/lua_dev_deps
SOURCE_DIR ${DEPS_SHARE_DIR}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
EXCLUDE_FROM_ALL TRUE
DOWNLOAD_NO_PROGRESS TRUE)
${EXTERNALPROJECT_OPTIONS})
else()
add_custom_target(lua-dev-deps)
add_custom_target(lua_dev_deps)
endif()

View File

@@ -55,12 +55,12 @@ Several Neovim GUIs are available from scoop (extras): [scoop.sh/#/apps?q=neovim
1. Choose a package (**nvim-winXX.zip**) from the [releases page](https://github.com/neovim/neovim/releases).
2. Unzip the package. Any location is fine, administrator privileges are _not_ required.
- `$VIMRUNTIME` will be set to that location automatically.
3. Double-click `nvim-qt.exe`.
3. Run `nvim.exe` from a terminal.
**Optional** steps:
- Add the `bin` folder (e.g. `C:\Program Files\nvim\bin`) to your PATH.
- This makes it easy to run `nvim` and `nvim-qt` from anywhere.
- This makes it easy to run `nvim` from anywhere.
- If `:set spell` does not work, create the `C:/Users/foo/AppData/Local/nvim/site/spell` folder.
You can then copy your spell files over (for English, located
[here](https://github.com/vim/vim/blob/master/runtime/spell/en.utf-8.spl) and

View File

@@ -74,25 +74,6 @@ if(APPLE)
message(STATUS "Using deployment target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
set_directory_properties(PROPERTIES
EP_PREFIX "${DEPS_BUILD_DIR}"
CMAKE_CONFIGURE_DEPENDS deps.txt)
file(READ deps.txt DEPENDENCIES)
STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}")
foreach(dep ${DEPENDENCIES})
STRING(REGEX REPLACE " " ";" dep "${dep}")
list(GET dep 0 name)
list(GET dep 1 value)
if(NOT ${name})
# _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set,
# otherwise ExternalProject will try to re-download the sources.
if(NOT USE_EXISTING_SRC_DIR)
set(${name} ${value})
endif()
endif()
endforeach()
if(USE_BUNDLED_LUAJIT)
set(LUA_ENGINE LuaJit)
elseif(USE_BUNDLED_LUA)

View File

@@ -28,7 +28,7 @@ function(BuildTSParser)
${EXTERNALPROJECT_OPTIONS})
endfunction()
foreach(lang c lua vim vimdoc query python bash)
foreach(lang c lua vim vimdoc query)
BuildTSParser(LANG ${lang})
endforeach()
BuildTSParser(LANG markdown CMAKE_FILE MarkdownParserCMakeLists.txt)

View File

@@ -41,21 +41,22 @@ GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c
LIBICONV_URL https://github.com/neovim/deps/raw/b9bf36eb31f27e8136d907da38fa23518927737e/opt/libiconv-1.17.tar.gz
LIBICONV_SHA256 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.0.tar.gz
TREESITTER_C_SHA256 6f0f5d1b71cf8ffd8a37fb638c6022fa1245bd630150b538547d52128ce0ea7e
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.3.tar.gz
TREESITTER_C_SHA256 75a3780df6114cd37496761c4a7c9fd900c78bee3a2707f590d78c0ca3a24368
TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.1.0.tar.gz
TREESITTER_LUA_SHA256 230cfcbfa74ed1f7b8149e9a1f34c2efc4c589a71fe0f5dc8560622f8020d722
TREESITTER_VIM_URL https://github.com/neovim/tree-sitter-vim/archive/v0.4.0.tar.gz
TREESITTER_VIM_SHA256 9f856f8b4a10ab43348550fa2d3cb2846ae3d8e60f45887200549c051c66f9d5
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v2.5.1.tar.gz
TREESITTER_VIMDOC_SHA256 063645096504b21603585507c41c6d8718ff3c11b2150c5bfc31e8f3ee9afea3
TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.3.0.tar.gz
TREESITTER_QUERY_SHA256 f878ff37abcb83250e31a6569e997546f3dbab74dcb26683cb2d613f7568cfc0
TREESITTER_PYTHON_URL https://github.com/tree-sitter/tree-sitter-python/archive/v0.21.0.tar.gz
TREESITTER_PYTHON_SHA256 720304a603271fa89e4430a14d6a81a023d6d7d1171b1533e49c0ab44f1e1c13
TREESITTER_BASH_URL https://github.com/tree-sitter/tree-sitter-bash/archive/v0.21.0.tar.gz
TREESITTER_BASH_SHA256 f0515efda839cfede851adb24ac154227fbc0dfb60c6c11595ecfa9087d43ceb
TREESITTER_VIMDOC_URL https://github.com/neovim/tree-sitter-vimdoc/archive/v3.0.0.tar.gz
TREESITTER_VIMDOC_SHA256 a639bf92bf57bfa1cdc90ca16af27bfaf26a9779064776dd4be34c1ef1453f6c
TREESITTER_QUERY_URL https://github.com/tree-sitter-grammars/tree-sitter-query/archive/v0.4.0.tar.gz
TREESITTER_QUERY_SHA256 d3a423ab66dc62b2969625e280116678a8a22582b5ff087795222108db2f6a6e
TREESITTER_MARKDOWN_URL https://github.com/MDeiml/tree-sitter-markdown/archive/v0.2.3.tar.gz
TREESITTER_MARKDOWN_SHA256 4909d6023643f1afc3ab219585d4035b7403f3a17849782ab803c5f73c8a31d5
TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.22.6.tar.gz
TREESITTER_SHA256 e2b687f74358ab6404730b7fb1a1ced7ddb3780202d37595ecd7b20a8f41861f
UNCRUSTIFY_URL https://github.com/uncrustify/uncrustify/archive/uncrustify-0.79.0.tar.gz
UNCRUSTIFY_SHA256 e7afaeabf636b7f0ce4e3e9747b95f7bd939613a8db49579755dddf44fedca5f
LUA_DEV_DEPS_URL https://github.com/neovim/deps/raw/5a1f71cceb24990a0b15fd9a472a5f549f019248/opt/lua-dev-deps.tar.gz
LUA_DEV_DEPS_SHA256 27db2495f5eddc7fc191701ec9b291486853530c6125609d3197d03481e8d5a2

View File

@@ -6,7 +6,7 @@
Name='PATH'
Action='set'
Permanent='no'
System='no'
System='yes'
Part='last'
Value='[INSTALL_ROOT]bin'
/>

View File

@@ -58,6 +58,32 @@ if(CMAKE_OSX_SYSROOT)
set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}")
endif()
get_filename_component(rootdir ${PROJECT_SOURCE_DIR} NAME)
if(${rootdir} MATCHES "cmake.deps")
set(depsfile ${PROJECT_SOURCE_DIR}/deps.txt)
else()
set(depsfile ${PROJECT_SOURCE_DIR}/cmake.deps/deps.txt)
endif()
set_directory_properties(PROPERTIES
EP_PREFIX "${DEPS_BUILD_DIR}"
CMAKE_CONFIGURE_DEPENDS ${depsfile})
file(READ ${depsfile} DEPENDENCIES)
STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}")
foreach(dep ${DEPENDENCIES})
STRING(REGEX REPLACE " " ";" dep "${dep}")
list(GET dep 0 name)
list(GET dep 1 value)
if(NOT ${name})
# _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set,
# otherwise ExternalProject will try to re-download the sources.
if(NOT USE_EXISTING_SRC_DIR)
set(${name} ${value})
endif()
endif()
endforeach()
function(get_externalproject_options name DEPS_IGNORE_SHA)
string(TOUPPER ${name} name_allcaps)
set(url ${${name_allcaps}_URL})

View File

@@ -2820,7 +2820,7 @@ nvim_set_decoration_provider({ns_id}, {opts})
Note: this function should not be called often. Rather, the callbacks
themselves can be used to throttle unneeded callbacks. the `on_start`
callback can return `false` to disable the provider until the next redraw.
Similarly, return `false` in `on_win` will skip the `on_lines` calls for
Similarly, return `false` in `on_win` will skip the `on_line` calls for
that window (but any extmarks set in `on_win` will still be used). A
plugin managing multiple sources of decoration should ideally only set one
provider, and merge the sources internally. You can use multiple `ns_id`
@@ -2829,10 +2829,10 @@ nvim_set_decoration_provider({ns_id}, {opts})
Note: doing anything other than setting extmarks is considered
experimental. Doing things like changing options are not explicitly
forbidden, but is likely to have unexpected consequences (such as 100% CPU
consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
quite dubious for the moment.
Note: It is not allowed to remove or update extmarks in 'on_line'
Note: It is not allowed to remove or update extmarks in `on_line`
callbacks.
Attributes: ~

View File

@@ -2963,8 +2963,8 @@ getregion({pos1}, {pos2} [, {opts}]) *getregion()*
difference if the buffer is displayed in a window with
different 'virtualedit' or 'list' values.
Examples: >
:xnoremap <CR>
Examples: >vim
xnoremap <CR>
\ <Cmd>echom getregion(
\ getpos('v'), getpos('.'), #{ type: mode() })<CR>
<
@@ -3507,7 +3507,7 @@ id({expr}) *id()*
Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
`v:_null_blob` have the same `id()` with different types
because they are internally represented as NULL pointers.
`id()` returns a hexadecimal representanion of the pointers to
`id()` returns a hexadecimal representation of the pointers to
the containers (i.e. like `0x994a40`), same as `printf("%p",
{expr})`, but it is advised against counting on the exact
format of the return value.
@@ -4597,19 +4597,19 @@ matchbufline({buf}, {pat}, {lnum}, {end}, [, {dict}]) *matchbufline()*
Examples: >vim
" Assuming line 3 in buffer 5 contains "a"
:echo matchbufline(5, '\<\k\+\>', 3, 3)
[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
echo matchbufline(5, '\<\k\+\>', 3, 3)
< `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
" Assuming line 4 in buffer 10 contains "tik tok"
:echo matchbufline(10, '\<\k\+\>', 1, 4)
[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
<
echo matchbufline(10, '\<\k\+\>', 1, 4)
< `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
If {submatch} is present and is v:true, then submatches like
"\1", "\2", etc. are also returned. Example: >vim
" Assuming line 2 in buffer 2 contains "acd"
:echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
\ {'submatches': v:true})
[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
< The "submatches" List always contains 9 items. If a submatch
< `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
The "submatches" List always contains 9 items. If a submatch
is not found, then an empty string is returned for that
submatch.
@@ -4769,17 +4769,17 @@ matchstrlist({list}, {pat} [, {dict}]) *matchstrlist()*
option settings on the pattern.
Example: >vim
:echo matchstrlist(['tik tok'], '\<\k\+\>')
[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
:echo matchstrlist(['a', 'b'], '\<\k\+\>')
[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
<
echo matchstrlist(['tik tok'], '\<\k\+\>')
< `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
echo matchstrlist(['a', 'b'], '\<\k\+\>')
< `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
If "submatches" is present and is v:true, then submatches like
"\1", "\2", etc. are also returned. Example: >vim
:echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
\ #{submatches: v:true})
[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
< The "submatches" List always contains 9 items. If a submatch
< `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
The "submatches" List always contains 9 items. If a submatch
is not found, then an empty string is returned for that
submatch.
@@ -6007,7 +6007,7 @@ screencol() *screencol()*
the following mappings: >vim
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
nnoremap <silent> GG :echom screencol()<CR>
noremap GG <Cmd>echom screencol()<Cr>
noremap GG <Cmd>echom screencol()<CR>
<
screenpos({winid}, {lnum}, {col}) *screenpos()*

View File

@@ -1623,7 +1623,7 @@ There are three different types of searching:
stop-directories are appended to the path (for the 'path' option) or to
the filename (for the 'tags' option) with a ';'. If you want several
stop-directories separate them with ';'. If you want no stop-directory
("search upward till the root directory) just use ';'. >
("search upward till the root directory") just use ';'. >
/usr/include/sys;/usr
< will search in: >
/usr/include/sys
@@ -1636,7 +1636,7 @@ There are three different types of searching:
If Vim's current path is /u/user_x/work/release and you do >
:set path=include;/u/user_x
< and then search for a file with |gf| the file is searched in: >
< and then search for a file with |gf| the file is searched in: >
/u/user_x/work/release/include
/u/user_x/work/include
/u/user_x/include
@@ -1648,7 +1648,7 @@ There are three different types of searching:
3) Combined up/downward search:
If Vim's current path is /u/user_x/work/release and you do >
set path=**;/u/user_x
< and then search for a file with |gf| the file is searched in: >
< and then search for a file with |gf| the file is searched in: >
/u/user_x/work/release/**
/u/user_x/work/**
/u/user_x/**
@@ -1660,10 +1660,10 @@ There are three different types of searching:
In the above example you might want to set path to: >
:set path=**,/u/user_x/**
< This searches:
/u/user_x/work/release/** ~
/u/user_x/** ~
This searches the same directories, but in a different order.
< This searches: >
/u/user_x/work/release/**
/u/user_x/**
< This searches the same directories, but in a different order.
Note that completion for ":find", ":sfind", and ":tabfind" commands do not
currently work with 'path' items that contain a URL or use the double star

View File

@@ -293,7 +293,7 @@ loaded by Vim: >
ftplugin/sql.vim
syntax/sqlinformix.vim
indent/sql.vim
>
<
Notice indent/sqlinformix.sql was not loaded. There is no indent file
for Informix, Vim loads the default files if the specified files does not
exist.
@@ -349,7 +349,7 @@ The defaults static maps are: >
The use of "<C-C>" can be user chosen by using the following in your |init.vim|
as it may not work properly on all platforms: >
let g:ftplugin_sql_omni_key = '<C-C>'
>
<
The static maps (which are based on the syntax highlight groups) follow this
format: >
imap <buffer> <C-C>k <C-\><C-O>:call sqlcomplete#Map('sqlKeyword')<CR><C-X><C-O>
@@ -664,7 +664,7 @@ your |init.vim|: >
filetype is changed temporarily to SQL, the sqlcompletion plugin
will cache the syntax groups listed in the List specified in this
option.
>
------------------------------------------------------------------------------
4.5 SQL Maps *sql-completion-maps*

View File

@@ -366,7 +366,7 @@ tag char note action in Normal mode ~
or start of putted text
|`]| `] 1 cursor to the end of last operated text or
end of putted text
|``| `` 1 cursor to the position before latest jump
|``| "``" 1 cursor to the position before latest jump
|`{| `{ 1 cursor to the start of the current paragraph
|`}| `} 1 cursor to the end of the current paragraph
|a| a 2 append text after the cursor N times
@@ -397,7 +397,7 @@ tag char note action in Normal mode ~
|q| q{0-9a-zA-Z"} record typed characters into named register
{0-9a-zA-Z"} (uppercase to append)
|q| q (while recording) stops recording
|Q| Q replay last recorded macro
|Q| Q 2 replay last recorded register
|q:| q: edit : command-line in command-line window
|q/| q/ edit / command-line in command-line window
|q?| q? edit ? command-line in command-line window
@@ -736,7 +736,7 @@ tag char note action in Normal mode ~
search pattern and Visually select it
|gP| ["x]gP 2 put the text [from register x] before the
cursor N times, leave the cursor after it
|gQ| gQ switch to "Ex" mode with Vim editing
|gQ| gQ switch to "Ex" mode with Vim editing
|gR| gR 2 enter Virtual Replace mode
|gT| gT go to the previous tab page
|gU| gU{motion} 2 make Nmove text uppercase
@@ -923,7 +923,6 @@ tag command note action in Visual mode ~
|v_O| O move horizontally to other corner of area
|v_P| P replace highlighted area with register
contents; registers are unchanged
Q does not start Ex mode
|v_R| R 2 delete the highlighted lines and start
insert
|v_S| S 2 delete the highlighted lines and start
@@ -1136,7 +1135,7 @@ tag command action ~
|:!!| :!! repeat last ":!" command
|:#| :# same as ":number"
|:&| :& repeat last ":substitute"
|:star| :* use the last Visual area, like :'<,'>
|:star| :* use the last Visual area, like ":'<,'>"
|:<| :< shift lines one 'shiftwidth' left
|:=| := print the last line number
|:>| :> shift lines one 'shiftwidth' right

View File

@@ -1927,11 +1927,6 @@ These two commands will keep on asking for lines, until you type a line
containing only a ".". Watch out for lines starting with a backslash, see
|line-continuation|.
When in Ex mode (see |-e|) a backslash at the end of the line can be used to
insert a NUL character. To be able to have a line ending in a backslash use
two backslashes. This means that the number of backslashes is halved, but
only at the end of the line.
NOTE: These commands cannot be used with |:global| or |:vglobal|.
":append" and ":insert" don't work properly in between ":if" and
":endif", ":for" and ":endfor", ":while" and ":endwhile".

View File

@@ -12,7 +12,7 @@ enhanced LSP tools.
https://microsoft.github.io/language-server-protocol/
LSP facilitates features like go-to-definition, find-references, hover,
LSP facilitates features like go-to-definition, find references, hover,
completion, rename, format, refactor, etc., using semantic whole-project
analysis (unlike |ctags|).
@@ -25,26 +25,36 @@ Nvim provides an LSP client, but the servers are provided by third parties.
Follow these steps to get LSP features:
1. Install language servers using your package manager or by following the
upstream installation instruction. You can find language servers here:
upstream installation instructions. You can find language servers here:
https://microsoft.github.io/language-server-protocol/implementors/servers/
2. Configure the LSP client per language server. See |vim.lsp.start()| or use
this minimal example as a guide: >lua
2. Use |vim.lsp.start()| to start the LSP server (or attach to an existing
one) when a file is opened. Example: >lua
-- Create an event handler for the FileType autocommand
vim.api.nvim_create_autocmd('FileType', {
-- This handler will fire when the buffer's 'filetype' is "python"
pattern = 'python',
callback = function(ev)
vim.lsp.start({
name = 'my-server-name',
cmd = {'name-of-language-server-executable', '--option', 'arg1', 'arg2'},
vim.lsp.start({
name = 'my-server-name',
cmd = {'name-of-language-server-executable'},
root_dir = vim.fs.root(0, {'setup.py', 'pyproject.toml'}),
-- Set the "root directory" to the parent directory of the file in the
-- current buffer (`ev.buf`) that contains either a "setup.py" or a
-- "pyproject.toml" file. Files that share a root directory will reuse
-- the connection to the same LSP server.
root_dir = vim.fs.root(ev.buf, {'setup.py', 'pyproject.toml'}),
})
end,
})
<
3. Check that the server attached to the buffer: >
:lua =vim.lsp.get_clients()
3. Check that the buffer is attached to the server: >vim
:checkhealth lsp
4. Configure keymaps and autocmds to use LSP features. See |lsp-config|.
4. (Optional) Configure keymaps and autocommands to use LSP features. |lsp-config|
*lsp-config*
*lsp-defaults*
When the LSP client starts it enables diagnostics |vim.diagnostic| (see
When the Nvim LSP client starts it enables diagnostics |vim.diagnostic| (see
|vim.diagnostic.config()| to customize). It also sets various default options,
listed below, if (1) the language server supports the functionality and (2)
the options are empty or were set by the builtin runtime (ftplugin) files. The
@@ -57,12 +67,13 @@ options are not restored when the LSP client is stopped or detached.
|CTRL-W_}| to utilize the language server.
- 'formatexpr' is set to |vim.lsp.formatexpr()|, so you can format lines via
|gq| if the language server supports it.
- To opt out of this use |gw| instead of gq, or set 'formatexpr' on LspAttach.
- To opt out of this use |gw| instead of gq, or clear 'formatexpr' on |LspAttach|.
- |K| is mapped to |vim.lsp.buf.hover()| unless |'keywordprg'| is customized or
a custom keymap for `K` exists.
*lsp-defaults-disable*
To override the above defaults, set or unset the options on |LspAttach|: >lua
To override or delete any of the above defaults, set or unset the options on
|LspAttach|: >lua
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(ev)
@@ -71,7 +82,8 @@ To override the above defaults, set or unset the options on |LspAttach|: >lua
vim.keymap.del('n', 'K', { buffer = ev.buf })
end,
})
<
*lsp-config*
To use other LSP features, set keymaps on |LspAttach|. Not all language
servers provide the same capabilities. To ensure you only set keymaps if the
language server supports a feature, guard keymaps behind capability checks.
@@ -201,26 +213,26 @@ Each response handler has this signature: >
function(err, result, ctx, config)
<
Parameters: ~
- {err} (table|nil) Error info dict, or `nil` if the request
completed.
- {result} (Result | Params | nil) `result` key of the |lsp-response| or
`nil` if the request failed.
- {ctx} (table) Table of calling state associated with the
handler, with these keys:
- {method} (string) |lsp-method| name.
- {client_id} (number) |vim.lsp.Client| identifier.
- {bufnr} (Buffer) Buffer handle.
- {params} (table|nil) Request parameters table.
- {version} (number) Document version at time of
request. Handlers can compare this to the
current document version to check if the
response is "stale". See also |b:changedtick|.
- {config} (table) Handler-defined configuration table, which allows
users to customize handler behavior.
For an example, see:
|vim.lsp.diagnostic.on_publish_diagnostics()|
To configure a particular |lsp-handler|, see:
|lsp-handler-configuration|
{err} (`table|nil`) Error info dict, or `nil` if the request
completed.
{result} (`Result|Params|nil`) `result` key of the |lsp-response| or
`nil` if the request failed.
{ctx} (`table`) Table of calling state associated with the
handler, with these keys:
{method} (`string`) |lsp-method| name.
{client_id} (`number`) |vim.lsp.Client| identifier.
{bufnr} (`Buffer`) Buffer handle.
{params} (`table|nil`) Request parameters table.
{version} (`number`) Document version at time of
request. Handlers can compare this to the
current document version to check if the
response is "stale". See also |b:changedtick|.
{config} (`table`) Handler-defined configuration table, which allows
users to customize handler behavior.
For an example, see:
|vim.lsp.diagnostic.on_publish_diagnostics()|
To configure a particular |lsp-handler|, see:
|lsp-handler-configuration|
Returns: ~
Two values `result, err` where `err` is shaped like an RPC error: >
@@ -977,7 +989,7 @@ Lua module: vim.lsp.client *lsp-client*
if the client supports workspace folders. It
can be `null` if the client supports workspace
folders but none are configured.
• {root_dir} (`string`)
• {root_dir} (`string?`)
• {attached_buffers} (`table<integer,true>`)
• {commands} (`table<string,fun(command: lsp.Command, ctx: table)>`)
Table of command name to function which is
@@ -1634,7 +1646,7 @@ is_enabled({filter}) *vim.lsp.inlay_hint.is_enabled()*
Query whether inlay hint is enabled in the {filter}ed scope
Parameters: ~
• {filter} (`table`) Optional filters |kwargs|, or `nil` for all.
• {filter} (`table?`) Optional filters |kwargs|, or `nil` for all.
• {bufnr} (`integer?`) Buffer number, or 0 for current
buffer, or nil for all.

View File

@@ -3012,7 +3012,10 @@ vim.fs.parents({start}) *vim.fs.parents()*
vim.fs.root({source}, {marker}) *vim.fs.root()*
Find the first parent directory containing a specific "marker", relative
to a buffer's directory.
to a file path or buffer.
If the buffer is unnamed (has no backing file) or has a non-empty
'buftype' then the search begins from Nvim's |current-directory|.
Example: >lua
-- Find the root of a Python project, starting from file 'main.py'
@@ -3029,7 +3032,8 @@ vim.fs.root({source}, {marker}) *vim.fs.root()*
Parameters: ~
• {source} (`integer|string`) Buffer number (0 for current buffer) or
file path to begin the search from.
file path (absolute or relative to the |current-directory|)
to begin the search from.
• {marker} (`string|string[]|fun(name: string, path: string): boolean`)
A marker, or list of markers, to search for. If a function,
the function is called for each evaluated item and should
@@ -3085,7 +3089,7 @@ In addition, its regex-like interface is available as |vim.re|
Pattern:match({subject}, {init}) *Pattern:match()*
Pattern:match({subject}, {init}, {...}) *Pattern:match()*
Matches the given `pattern` against the `subject` string. If the match
succeeds, returns the index in the subject of the first character after
the match, or the captured values (if the pattern captured any value). An
@@ -3108,9 +3112,10 @@ Pattern:match({subject}, {init}) *Pattern:match()*
Parameters: ~
• {subject} (`string`)
• {init} (`integer?`)
• {...} (`any`)
Return: ~
(`integer|vim.lpeg.Capture?`)
(`any`) ...
vim.lpeg.B({pattern}) *vim.lpeg.B()*
Returns a pattern that matches only if the input string at the current
@@ -3120,7 +3125,7 @@ vim.lpeg.B({pattern}) *vim.lpeg.B()*
or failure.
Parameters: ~
• {pattern} (`vim.lpeg.Pattern`)
• {pattern} (`vim.lpeg.Pattern|string|integer|boolean|table`)
Return: ~
(`vim.lpeg.Pattern`)
@@ -3144,7 +3149,7 @@ vim.lpeg.C({patt}) *vim.lpeg.C()*
<
Parameters: ~
• {patt} (`vim.lpeg.Pattern`)
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
Return: ~
(`vim.lpeg.Capture`)
@@ -3195,11 +3200,11 @@ vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
This capture assumes that `patt` should produce at least one capture with
at least one value (of any type), which becomes the initial value of an
accumulator. (If you need a specific initial value, you may prefix a
constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
with this accumulator as the first argument and all values produced by the
capture as extra arguments; the first result from this call becomes the
new value for the accumulator. The final value of the accumulator becomes
the captured value.
constant capture to `patt`.) For each subsequent capture, LPeg calls
`func` with this accumulator as the first argument and all values produced
by the capture as extra arguments; the first result from this call becomes
the new value for the accumulator. The final value of the accumulator
becomes the captured value.
Example: >lua
local number = lpeg.R('09') ^ 1 / tonumber
@@ -3210,7 +3215,7 @@ vim.lpeg.Cf({patt}, {func}) *vim.lpeg.Cf()*
<
Parameters: ~
• {patt} (`vim.lpeg.Pattern`)
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {func} (`fun(acc, newvalue)`)
Return: ~
@@ -3222,7 +3227,7 @@ vim.lpeg.Cg({patt}, {name}) *vim.lpeg.Cg()*
with the given name (which can be any non-nil Lua value).
Parameters: ~
• {patt} (`vim.lpeg.Pattern`)
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {name} (`string?`)
Return: ~
@@ -3245,8 +3250,9 @@ vim.lpeg.Cmt({patt}, {fn}) *vim.lpeg.Cmt()*
function become the values produced by the capture.
Parameters: ~
• {patt} (`vim.lpeg.Pattern`)
• {fn} (`function`)
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {fn} (`fun(s: string, i: integer, ...: any)`) (position:
boolean|integer, ...: any)
Return: ~
(`vim.lpeg.Capture`)
@@ -3285,7 +3291,7 @@ vim.lpeg.Cs({patt}) *vim.lpeg.Cs()*
<
Parameters: ~
• {patt} (`vim.lpeg.Pattern`)
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
Return: ~
(`vim.lpeg.Capture`)
@@ -3298,7 +3304,7 @@ vim.lpeg.Ct({patt}) *vim.lpeg.Ct()*
the group name as its key. The captured value is only the table.
Parameters: ~
• {patt} (`vim.lpeg.Pattern|''`)
• {patt} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
Return: ~
(`vim.lpeg.Capture`)
@@ -3333,7 +3339,7 @@ vim.lpeg.locale({tab}) *vim.lpeg.locale()*
Return: ~
(`vim.lpeg.Locale`)
vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
vim.lpeg.match({pattern}, {subject}, {init}, {...}) *vim.lpeg.match()*
Matches the given `pattern` against the `subject` string. If the match
succeeds, returns the index in the subject of the first character after
the match, or the captured values (if the pattern captured any value). An
@@ -3354,12 +3360,13 @@ vim.lpeg.match({pattern}, {subject}, {init}) *vim.lpeg.match()*
<
Parameters: ~
• {pattern} (`vim.lpeg.Pattern`)
• {pattern} (`vim.lpeg.Pattern|string|integer|boolean|table|function`)
• {subject} (`string`)
• {init} (`integer?`)
• {...} (`any`)
Return: ~
(`integer|vim.lpeg.Capture?`)
(`any`) ...
vim.lpeg.P({value}) *vim.lpeg.P()*
Converts the given value into a proper pattern. The following rules are
@@ -3453,7 +3460,7 @@ vim.lpeg.V({v}) *vim.lpeg.V()*
<
Parameters: ~
• {v} (`string|integer`)
• {v} (`boolean|string|number|function|table|thread|userdata|lightuserdata`)
Return: ~
(`vim.lpeg.Pattern`)
@@ -4385,8 +4392,9 @@ vim.text.hexdecode({enc}) *vim.text.hexdecode()*
Parameters: ~
• {enc} (`string`) String to decode
Return: ~
(`string`) Decoded string
Return (multiple): ~
(`string?`) Decoded string
(`string?`) Error message, if any
vim.text.hexencode({str}) *vim.text.hexencode()*
Hex encode a string.
@@ -4402,7 +4410,7 @@ vim.text.hexencode({str}) *vim.text.hexencode()*
Lua module: tohtml *vim.tohtml*
:TOhtml {file} *:TOhtml*
:[range]TOhtml {file} *:TOhtml*
Converts the buffer shown in the current window to HTML, opens the generated
HTML in a new split window, and saves its contents to {file}. If {file} is not
given, a temporary file (created by |tempname()|) is used.
@@ -4424,6 +4432,8 @@ tohtml.tohtml({winid}, {opt}) *tohtml.tohtml.tohtml()*
• {width}? (`integer`, default: 'textwidth' if non-zero or
window width otherwise) Width used for items which are
either right aligned or repeat a character infinitely.
• {range}? (`integer[]`, default: entire buffer) Range of
rows to use.
Return: ~
(`string[]`)

View File

@@ -349,8 +349,8 @@ The following new features were added.
|default-autocmds|
• Treesitter:
• Bundled parsers and queries (highlight, folds) for Markdown, Python, and
Bash.
• Bundled parsers and queries (highlight, folds) for Markdown (used for LSP
hover).
• |:InspectTree| shows root nodes.
• |:InspectTree| now supports |folding|.
• |:InspectTree| shows node ranges in 0-based instead of 1-based indexing.

View File

@@ -1092,7 +1092,7 @@ A jump table for the options with a short description can be found at |Q_op|.
applying 'breakindent', even if the resulting
text should normally be narrower. This prevents
text indented almost to the right window border
occupying lot of vertical space when broken.
occupying lots of vertical space when broken.
(default: 20)
shift:{n} After applying 'breakindent', the wrapped line's
beginning will be shifted by the given number of
@@ -3439,7 +3439,7 @@ A jump table for the options with a short description can be found at |Q_op|.
in Insert mode as specified with the 'indentkeys' option.
When this option is not empty, it overrules the 'cindent' and
'smartindent' indenting. When 'lisp' is set, this option is
is only used when 'lispoptions' contains "expr:1".
only used when 'lispoptions' contains "expr:1".
The expression is evaluated with |v:lnum| set to the line number for
which the indent is to be computed. The cursor is also in this line
when the expression is evaluated (but it may be moved around).
@@ -3688,7 +3688,7 @@ A jump table for the options with a short description can be found at |Q_op|.
part can be in one of two forms:
1. A list of pairs. Each pair is a "from" character immediately
followed by the "to" character. Examples: "aA", "aAbBcC".
2. A list of "from" characters, a semi-colon and a list of "to"
2. A list of "from" characters, a semicolon and a list of "to"
characters. Example: "abc;ABC"
Example: "aA,fgh;FGH,cCdDeE"
Special characters need to be preceded with a backslash. These are
@@ -3756,7 +3756,7 @@ A jump table for the options with a short description can be found at |Q_op|.
update use |:redraw|.
This may occasionally cause display errors. It is only meant to be set
temporarily when performing an operation where redrawing may cause
flickering or cause a slow down.
flickering or cause a slowdown.
*'linebreak'* *'lbr'* *'nolinebreak'* *'nolbr'*
'linebreak' 'lbr' boolean (default off)
@@ -3834,6 +3834,9 @@ A jump table for the options with a short description can be found at |Q_op|.
between tabs and spaces and for trailing blanks. Further changed by
the 'listchars' option.
When 'listchars' does not contain "tab" field, tabs are shown as "^I"
or "<09>", like how unprintable characters are displayed.
The cursor is displayed at the start of the space a Tab character
occupies, not at the end as usual in Normal mode. To get this cursor
position while displaying Tabs with spaces, use: >vim
@@ -4582,7 +4585,7 @@ A jump table for the options with a short description can be found at |Q_op|.
set path+=
< To use an environment variable, you probably need to replace the
separator. Here is an example to append $INCL, in which directory
names are separated with a semi-colon: >vim
names are separated with a semicolon: >vim
let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
< Replace the ';' with a ':' or whatever separator is used. Note that
this doesn't work when $INCL contains a comma or white space.
@@ -5442,7 +5445,7 @@ A jump table for the options with a short description can be found at |Q_op|.
'shortmess' 'shm' string (default "ltToOCF")
global
This option helps to avoid all the |hit-enter| prompts caused by file
messages, for example with CTRL-G, and to avoid some other messages.
messages, for example with CTRL-G, and to avoid some other messages.
It is a list of flags:
flag meaning when present ~
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
@@ -5847,7 +5850,7 @@ A jump table for the options with a short description can be found at |Q_op|.
minus two.
timeout:{millisec} Limit the time searching for suggestions to
{millisec} milli seconds. Applies to the following
{millisec} milliseconds. Applies to the following
methods. When omitted the limit is 5000. When
negative there is no limit.

View File

@@ -4986,7 +4986,6 @@ 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.
@@ -5006,7 +5005,6 @@ CursorLineSign Like SignColumn when 'cursorline' is set for the cursor line.
*hl-MatchParen*
MatchParen Character under the cursor or just before it, if it
is a paired bracket, and its match. |pi_paren.txt|
*hl-ModeMsg*
ModeMsg 'showmode' message (e.g., "-- INSERT --").
*hl-MsgArea*
@@ -5052,7 +5050,7 @@ PmenuThumb Popup menu: Thumb of the scrollbar.
Question |hit-enter| prompt and yes/no questions.
*hl-QuickFixLine*
QuickFixLine Current |quickfix| item in the quickfix window. Combined with
|hl-CursorLine| when the cursor is there.
|hl-CursorLine| when the cursor is there.
*hl-Search*
Search Last search pattern highlighting (see 'hlsearch').
Also used for similar items that need to stand out.

View File

@@ -22,9 +22,11 @@ search for in the `parser` runtime directory.
Nvim includes these parsers:
- Bash
- C
- Lua
- Markdown
- Python
- Vimscript
- Vimdoc
- Treesitter query files |ft-query-plugin|

View File

@@ -87,7 +87,7 @@ The ":tags" command shows the list of tags that you traversed through:
1 1 write_line 8 write_block.c ~
2 1 write_char 7 write_line.c ~
> ~
>
<
Now to go back. The CTRL-T command goes to the preceding tag. In the example
above you get back to the "write_line" function, in the call to "write_char".
This command takes a count argument that indicates how many tags to jump

View File

@@ -209,7 +209,7 @@ gx Opens the current filepath or URL (decided by
This implies that an insert command must be completed
(to start Insert mode, see |:startinsert|). A ":"
command must be completed as well. And you can't use
"Q" or "gQ" to start Ex mode.
"gQ" to start Ex mode.
The display is not updated while ":normal" is busy.
@@ -579,6 +579,10 @@ Acting on multiple lines behaves as follows:
transformed to empty comments (e.g. `/**/`). Comment markers are aligned to
the least indented line.
Matching 'commentstring' does not account for whitespace in comment markers.
Removing comment markers is first attempted exactly, with fallback to using
markers trimmed from whitespace.
If the filetype of the buffer is associated with a language for which a
|treesitter| parser is installed, then |vim.filetype.get_option()| is called
to look up the value of 'commentstring' corresponding to the cursor position.

View File

@@ -10,7 +10,8 @@ if exists("b:did_ftplugin")
endif
" Behaves mostly just like C
runtime! ftplugin/c.{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
" XXX: "[.]" in the first pattern makes it a wildcard on Windows
runtime! ftplugin/c[.]{vim,lua} ftplugin/c_*.{vim,lua} ftplugin/c/*.{vim,lua}
" C++ uses templates with <things>
" Disabled, because it gives an error for typing an unmatched ">".

View File

@@ -0,0 +1 @@
vim.bo.commentstring = '// %s'

View File

@@ -50,11 +50,11 @@ local function check_config()
local init_lua = vim.fn.stdpath('config') .. '/init.lua'
local init_vim = vim.fn.stdpath('config') .. '/init.vim'
local vimrc = vim.env.MYVIMRC and vim.fn.expand(vim.env.MYVIMRC) or init_lua
local vimrc = vim.env.MYVIMRC and vim.fs.normalize(vim.env.MYVIMRC) or init_lua
if vim.fn.filereadable(vimrc) == 0 and vim.fn.filereadable(init_vim) == 0 then
ok = false
local has_vim = vim.fn.filereadable(vim.fn.expand('~/.vimrc')) == 1
local has_vim = vim.fn.filereadable(vim.fs.normalize('~/.vimrc')) == 1
health.warn(
('%s user config file: %s'):format(
-1 == vim.fn.getfsize(vimrc) and 'Missing' or 'Unreadable',
@@ -114,7 +114,7 @@ local function check_config()
)
shadafile = (
vim.o.shadafile == ''
and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fn.expand(
and (shadafile == '' and vim.fn.stdpath('state') .. '/shada/main.shada' or vim.fs.normalize(
shadafile
))
or (vim.o.shadafile == 'NONE' and '' or vim.o.shadafile)

View File

@@ -1,5 +1,5 @@
local health = vim.health
local iswin = vim.loop.os_uname().sysname == 'Windows_NT'
local iswin = vim.uv.os_uname().sysname == 'Windows_NT'
local M = {}
@@ -7,7 +7,7 @@ local function is(path, ty)
if not path then
return false
end
local stat = vim.loop.fs_stat(path)
local stat = vim.uv.fs_stat(path)
if not stat then
return false
end
@@ -77,12 +77,14 @@ local function download(url)
return out
end
elseif vim.fn.executable('python') == 1 then
local script = "try:\n\
from urllib.request import urlopen\n\
except ImportError:\n\
from urllib2 import urlopen\n\
response = urlopen('" .. url .. "')\n\
print(response.read().decode('utf8'))\n"
local script = ([[
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
response = urlopen('%s')
print(response.read().decode('utf8'))
]]):format(url)
local out, rc = health.system({ 'python', '-c', script })
if out == '' and rc ~= 0 then
return 'python urllib.request error: ' .. rc

View File

@@ -19,8 +19,7 @@ function M.check()
end
health.info('Ruby: ' .. health.system({ 'ruby', '-v' }))
local ruby_detect_table = vim.provider.ruby.detect()
local host = ruby_detect_table[1]
local host, _ = vim.provider.ruby.detect()
if (not host) or host:find('^%s*$') then
health.warn('`neovim-ruby-host` not found.', {
'Run `gem install neovim` to ensure the neovim RubyGem is installed.',

View File

@@ -1,6 +1,6 @@
--- @brief
---<pre>help
---:TOhtml {file} *:TOhtml*
---:[range]TOhtml {file} *:TOhtml*
---Converts the buffer shown in the current window to HTML, opens the generated
---HTML in a new split window, and saves its contents to {file}. If {file} is not
---given, a temporary file (created by |tempname()|) is used.
@@ -40,7 +40,8 @@
--- @field winid integer
--- @field bufnr integer
--- @field width integer
--- @field buflen integer
--- @field start integer
--- @field end_ integer
--- @class (private) vim.tohtml.styletable
--- @field [integer] vim.tohtml.line (integer: (1-index, exclusive))
@@ -57,6 +58,26 @@
--- @field [3] any[][] virt_text
--- @field [4] any[][] overlay_text
--- @type string[]
local notifications = {}
---@param msg string
local function notify(msg)
if #notifications == 0 then
vim.schedule(function()
if #notifications > 1 then
vim.notify(
('TOhtml: %s (+ %d more warnings)'):format(notifications[1], tostring(#notifications - 1))
)
elseif #notifications == 1 then
vim.notify('TOhtml: ' .. notifications[1])
end
notifications = {}
end)
end
table.insert(notifications, msg)
end
local HIDE_ID = -1
-- stylua: ignore start
local cterm_8_to_hex={
@@ -168,6 +189,8 @@ local background_color_cache = nil
--- @type string?
local foreground_color_cache = nil
local len = vim.api.nvim_strwidth
--- @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
--- @param color "background"|"foreground"|integer
--- @return string?
@@ -215,7 +238,7 @@ local function cterm_to_hex(colorstr)
if hex then
cterm_color_cache[color] = hex
else
vim.notify_once("Info(TOhtml): Couldn't get terminal colors, using fallback")
notify("Couldn't get terminal colors, using fallback")
local t_Co = tonumber(vim.api.nvim_eval('&t_Co'))
if t_Co <= 8 then
cterm_color_cache = cterm_8_to_hex
@@ -241,7 +264,7 @@ local function get_background_color()
end
local hex = try_query_terminal_color('background')
if not hex or not hex:match('#%x%x%x%x%x%x') then
vim.notify_once("Info(TOhtml): Couldn't get terminal background colors, using fallback")
notify("Couldn't get terminal background colors, using fallback")
hex = vim.o.background == 'light' and '#ffffff' or '#000000'
end
background_color_cache = hex
@@ -259,7 +282,7 @@ local function get_foreground_color()
end
local hex = try_query_terminal_color('foreground')
if not hex or not hex:match('#%x%x%x%x%x%x') then
vim.notify_once("Info(TOhtml): Couldn't get terminal foreground colors, using fallback")
notify("Couldn't get terminal foreground colors, using fallback")
hex = vim.o.background == 'light' and '#000000' or '#ffffff'
end
foreground_color_cache = hex
@@ -292,9 +315,12 @@ local function style_line_insert_virt_text(style_line, col, val)
end
--- @param state vim.tohtml.state
--- @param hl string|integer|nil
--- @param hl string|integer|string[]|integer[]?
--- @return nil|integer
local function register_hl(state, hl)
if type(hl) == 'table' then
hl = hl[#hl]
end
if type(hl) == 'nil' then
return
elseif type(hl) == 'string' then
@@ -370,7 +396,7 @@ end
--- @param state vim.tohtml.state
local function styletable_syntax(state)
for row = 1, state.buflen do
for row = state.start, state.end_ do
local prev_id = 0
local prev_col = nil
for col = 1, #vim.fn.getline(row) + 1 do
@@ -390,7 +416,7 @@ end
--- @param state vim.tohtml.state
local function styletable_diff(state)
local styletable = state.style
for row = 1, state.buflen do
for row = state.start, state.end_ do
local style_line = styletable[row]
local filler = vim.fn.diff_filler(row)
if filler ~= 0 then
@@ -400,7 +426,7 @@ local function styletable_diff(state)
{ { fill:rep(state.width), register_hl(state, 'DiffDelete') } }
)
end
if row == state.buflen + 1 then
if row == state.end_ + 1 then
break
end
local prev_id = 0
@@ -442,7 +468,9 @@ local function styletable_treesitter(state)
if not query then
return
end
for capture, node, metadata in query:iter_captures(root, buf_highlighter.bufnr, 0, state.buflen) do
for capture, node, metadata in
query:iter_captures(root, buf_highlighter.bufnr, state.start - 1, state.end_)
do
local srow, scol, erow, ecol = node:range()
--- @diagnostic disable-next-line: invisible
local c = q._query.captures[capture]
@@ -467,7 +495,7 @@ local function _styletable_extmarks_highlight(state, extmark, namespaces)
---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
---generated in visible lines, and not in the whole buffer.
if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_semantic_tokens') then
vim.notify_once('Info(TOhtml): lsp semantic tokens are not supported, HTML may be incorrect')
notify('lsp semantic tokens are not supported, HTML may be incorrect')
return
end
local srow, scol, erow, ecol =
@@ -481,17 +509,27 @@ end
--- @param state vim.tohtml.state
--- @param extmark {[1]:integer,[2]:integer,[3]:integer,[4]:vim.api.keyset.set_extmark|any}
local function _styletable_extmarks_virt_text(state, extmark)
--- @param namespaces table<integer,string>
local function _styletable_extmarks_virt_text(state, extmark, namespaces)
if not extmark[4].virt_text then
return
end
---TODO(altermo) LSP semantic tokens (and some other extmarks) are only
---generated in visible lines, and not in the whole buffer.
if (namespaces[extmark[4].ns_id] or ''):find('vim_lsp_inlayhint') then
notify('lsp inlay hints are not supported, HTML may be incorrect')
return
end
local styletable = state.style
--- @type integer,integer
local row, col = extmark[2], extmark[3]
if
extmark[4].virt_text_pos == 'inline'
or extmark[4].virt_text_pos == 'eol'
or extmark[4].virt_text_pos == 'overlay'
row < vim.api.nvim_buf_line_count(state.bufnr)
and (
extmark[4].virt_text_pos == 'inline'
or extmark[4].virt_text_pos == 'eol'
or extmark[4].virt_text_pos == 'overlay'
)
then
if extmark[4].virt_text_pos == 'eol' then
style_line_insert_virt_text(styletable[row + 1], #vim.fn.getline(row + 1) + 1, { ' ' })
@@ -510,7 +548,7 @@ local function _styletable_extmarks_virt_text(state, extmark)
else
style_line_insert_virt_text(styletable[row + 1], col + 1, { i[1], hlid })
end
virt_text_len = virt_text_len + #i[1]
virt_text_len = virt_text_len + len(i[1])
end
if extmark[4].virt_text_pos == 'overlay' then
styletable_insert_range(state, row + 1, col + 1, row + 1, col + virt_text_len + 1, HIDE_ID)
@@ -521,11 +559,9 @@ local function _styletable_extmarks_virt_text(state, extmark)
hl_mode = 'blend',
hl_group = 'combine',
}
for opt, val in ipairs(not_supported) do
for opt, val in pairs(not_supported) do
if extmark[4][opt] == val then
vim.notify_once(
('Info(TOhtml): extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val)
)
notify(('extmark.%s="%s" is not supported, HTML may be incorrect'):format(opt, val))
end
end
end
@@ -586,7 +622,7 @@ local function styletable_extmarks(state)
_styletable_extmarks_conceal(state, v)
end
for _, v in ipairs(extmarks) do
_styletable_extmarks_virt_text(state, v)
_styletable_extmarks_virt_text(state, v, namespaces)
end
for _, v in ipairs(extmarks) do
_styletable_extmarks_virt_lines(state, v)
@@ -597,7 +633,7 @@ end
local function styletable_folds(state)
local styletable = state.style
local has_folded = false
for row = 1, state.buflen do
for row = state.start, state.end_ do
if vim.fn.foldclosed(row) > 0 then
has_folded = true
styletable[row].hide = true
@@ -611,9 +647,7 @@ local function styletable_folds(state)
end
end
if has_folded and type(({ pcall(vim.api.nvim_eval, vim.o.foldtext) })[2]) == 'table' then
vim.notify_once(
'Info(TOhtml): foldtext returning a table is half supported, HTML may be incorrect'
)
notify('foldtext returning a table with highlights is not supported, HTML may be incorrect')
end
end
@@ -621,7 +655,7 @@ end
local function styletable_conceal(state)
local bufnr = state.bufnr
vim.api.nvim_buf_call(bufnr, function()
for row = 1, state.buflen do
for row = state.start, state.end_ do
--- @type table<integer,{[1]:integer,[2]:integer,[3]:string}>
local conceals = {}
local line_len_exclusive = #vim.fn.getline(row) + 1
@@ -739,7 +773,7 @@ local function styletable_statuscolumn(state)
local max = tonumber(foldcolumn:match('^%w-:(%d)')) or 1
local maxfold = 0
vim.api.nvim_buf_call(state.bufnr, function()
for row = 1, vim.api.nvim_buf_line_count(state.bufnr) do
for row = state.start, state.end_ do
local foldlevel = vim.fn.foldlevel(row)
if foldlevel > maxfold then
maxfold = foldlevel
@@ -754,12 +788,12 @@ local function styletable_statuscolumn(state)
--- @type table<integer,any>
local statuses = {}
for row = 1, state.buflen do
for row = state.start, state.end_ do
local status = vim.api.nvim_eval_statusline(
statuscolumn,
{ winid = state.winid, use_statuscol_lnum = row, highlights = true }
)
local width = vim.api.nvim_strwidth(status.str)
local width = len(status.str)
if width > minwidth then
minwidth = width
end
@@ -774,7 +808,7 @@ local function styletable_statuscolumn(state)
for k, v in ipairs(hls) do
local text = str:sub(v.start + 1, hls[k + 1] and hls[k + 1].start or nil)
if k == #hls then
text = text .. (' '):rep(minwidth - vim.api.nvim_strwidth(str))
text = text .. (' '):rep(minwidth - len(str))
end
if text ~= '' then
local hlid = register_hl(state, v.group)
@@ -794,7 +828,6 @@ local function styletable_listchars(state)
local function utf8_sub(str, i, j)
return vim.fn.strcharpart(str, i - 1, j and j - i + 1 or nil)
end
local len = vim.api.nvim_strwidth
--- @type table<string,string>
local listchars = vim.opt_local.listchars:get()
local ids = setmetatable({}, {
@@ -805,7 +838,7 @@ local function styletable_listchars(state)
})
if listchars.eol then
for row = 1, state.buflen do
for row = state.start, state.end_ do
local style_line = state.style[row]
style_line_insert_overlay_char(
style_line,
@@ -1099,16 +1132,22 @@ end
local function extend_pre(out, state)
local styletable = state.style
table.insert(out, '<pre>')
local out_start = #out
local hide_count = 0
--- @type integer[]
local stack = {}
local before = ''
local after = ''
local function loop(row)
local inside = row <= state.end_ and row >= state.start
local style_line = styletable[row]
if style_line.hide and (styletable[row - 1] or {}).hide then
return
end
_extend_virt_lines(out, state, row)
if inside then
_extend_virt_lines(out, state, row)
end
--Possible improvement (altermo):
--Instead of looping over all the buffer characters per line,
--why not loop over all the style_line cells,
@@ -1118,8 +1157,16 @@ local function extend_pre(out, state)
end
local line = vim.api.nvim_buf_get_lines(state.bufnr, row - 1, row, false)[1] or ''
local s = ''
s = s .. _pre_text_to_html(state, row)
for col = 1, #line + 1 do
if inside then
s = s .. _pre_text_to_html(state, row)
end
local true_line_len = #line + 1
for k in pairs(style_line) do
if type(k) == 'number' and k > true_line_len then
true_line_len = k
end
end
for col = 1, true_line_len do
local cell = style_line[col]
--- @type table?
local char
@@ -1159,18 +1206,18 @@ local function extend_pre(out, state)
end
end
if cell[3] then
if cell[3] and inside then
s = s .. _virt_text_to_html(state, cell)
end
char = cell[4][#cell[4]]
end
if col == #line + 1 and not char then
if col == true_line_len and not char then
break
end
if hide_count == 0 then
if hide_count == 0 and inside then
s = s
.. _char_to_html(
state,
@@ -1179,12 +1226,20 @@ local function extend_pre(out, state)
)
end
end
table.insert(out, s)
if row > state.end_ + 1 then
after = after .. s
elseif row < state.start then
before = s .. before
else
table.insert(out, s)
end
end
for row = 1, state.buflen + 1 do
for row = 1, vim.api.nvim_buf_line_count(state.bufnr) + 1 do
loop(row)
end
out[out_start] = out[out_start] .. before
out[#out] = out[#out] .. after
assert(#stack == 0, 'an open HTML tag was never closed')
table.insert(out, '</pre>')
end
@@ -1216,6 +1271,7 @@ local function global_state_to_state(winid, global_state)
if not width or width < 1 then
width = vim.api.nvim_win_get_width(winid)
end
local range = opt.range or { 1, vim.api.nvim_buf_line_count(bufnr) }
local state = setmetatable({
winid = winid == 0 and vim.api.nvim_get_current_win() or winid,
opt = vim.wo[winid],
@@ -1223,7 +1279,8 @@ local function global_state_to_state(winid, global_state)
bufnr = bufnr,
tabstop = (' '):rep(vim.bo[bufnr].tabstop),
width = width,
buflen = vim.api.nvim_buf_line_count(bufnr),
start = range[1],
end_ = range[2],
}, { __index = global_state })
return state --[[@as vim.tohtml.state]]
end
@@ -1282,35 +1339,22 @@ local function state_generate_style(state)
end)
end
--- @param winid integer[]|integer
--- @param winid integer
--- @param opt? vim.tohtml.opt
--- @return string[]
local function win_to_html(winid, opt)
if type(winid) == 'number' then
winid = { winid }
end
--- @cast winid integer[]
assert(#winid > 0, 'no window specified')
opt = opt or {}
local title = table.concat(
vim.tbl_map(vim.api.nvim_buf_get_name, vim.tbl_map(vim.api.nvim_win_get_buf, winid)),
','
)
local title = vim.api.nvim_buf_get_name(vim.api.nvim_win_get_buf(winid))
local global_state = opt_to_global_state(opt, title)
--- @type vim.tohtml.state[]
local states = {}
for _, i in ipairs(winid) do
local state = global_state_to_state(i, global_state)
state_generate_style(state)
table.insert(states, state)
end
local state = global_state_to_state(winid, global_state)
state_generate_style(state)
local html = {}
extend_html(html, function()
extend_head(html, global_state)
extend_body(html, function()
for _, state in ipairs(states) do
extend_pre(html, state)
end
extend_pre(html, state)
end)
end)
return html
@@ -1337,6 +1381,10 @@ local M = {}
--- infinitely.
--- (default: 'textwidth' if non-zero or window width otherwise)
--- @field width? integer
---
--- Range of rows to use.
--- (default: entire buffer)
--- @field range? integer[]
--- Converts the buffer shown in the window {winid} to HTML and returns the output as a list of string.
--- @param winid? integer Window to convert (defaults to current window)

View File

@@ -77,14 +77,11 @@ local function make_comment_check(parts)
local l_esc, r_esc = vim.pesc(parts.left), vim.pesc(parts.right)
-- Commented line has the following structure:
-- <possible whitespace> <left> <anything> <right> <possible whitespace>
local nonblank_regex = '^%s-' .. l_esc .. '.*' .. r_esc .. '%s-$'
-- Commented blank line can have any amount of whitespace around parts
local blank_regex = '^%s-' .. vim.trim(l_esc) .. '%s*' .. vim.trim(r_esc) .. '%s-$'
-- <whitespace> <trimmed left> <anything> <trimmed right> <whitespace>
local regex = '^%s-' .. vim.trim(l_esc) .. '.*' .. vim.trim(r_esc) .. '%s-$'
return function(line)
return line:find(nonblank_regex) ~= nil or line:find(blank_regex) ~= nil
return line:find(regex) ~= nil
end
end
@@ -153,14 +150,14 @@ end
---@return fun(line: string): string
local function make_uncomment_function(parts)
local l_esc, r_esc = vim.pesc(parts.left), vim.pesc(parts.right)
local nonblank_regex = '^(%s*)' .. l_esc .. '(.*)' .. r_esc .. '(%s-)$'
local blank_regex = '^(%s*)' .. vim.trim(l_esc) .. '(%s*)' .. vim.trim(r_esc) .. '(%s-)$'
local regex = '^(%s*)' .. l_esc .. '(.*)' .. r_esc .. '(%s-)$'
local regex_trimmed = '^(%s*)' .. vim.trim(l_esc) .. '(.*)' .. vim.trim(r_esc) .. '(%s-)$'
return function(line)
-- Try both non-blank and blank regexes
local indent, new_line, trail = line:match(nonblank_regex)
-- Try regex with exact comment parts first, fall back to trimmed parts
local indent, new_line, trail = line:match(regex)
if new_line == nil then
indent, new_line, trail = line:match(blank_regex)
indent, new_line, trail = line:match(regex_trimmed)
end
-- Return original if line is not commented

View File

@@ -85,13 +85,13 @@ do
vim.keymap.set(
'x',
'Q',
"mode() == 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'",
"mode() ==# 'V' ? ':normal! @<C-R>=reg_recorded()<CR><CR>' : 'Q'",
{ silent = true, expr = true, desc = ':help v_Q-default' }
)
vim.keymap.set(
'x',
'@',
"mode() == 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'",
"mode() ==# 'V' ? ':normal! @'.getcharstr().'<CR>' : '@'",
{ silent = true, expr = true, desc = ':help v_@-default' }
)
@@ -266,7 +266,10 @@ do
return
end
vim.v.swapchoice = 'e' -- Choose "(E)dit".
vim.notify(('W325: Ignoring swapfile from Nvim process %d'):format(info.pid))
vim.notify(
('W325: Ignoring swapfile from Nvim process %d'):format(info.pid),
vim.log.levels.WARN
)
end,
})
@@ -431,10 +434,14 @@ do
--- response indicates that it does support truecolor enable 'termguicolors',
--- but only if the user has not already disabled it.
do
if tty.rgb then
-- The TUI was able to determine truecolor support
local colorterm = os.getenv('COLORTERM')
if tty.rgb or colorterm == 'truecolor' or colorterm == '24bit' then
-- The TUI was able to determine truecolor support or $COLORTERM explicitly indicates
-- truecolor support
setoption('termguicolors', true)
else
elseif colorterm == nil or colorterm == '' then
-- Neither the TUI nor $COLORTERM indicate that truecolor is supported, so query the
-- terminal
local caps = {} ---@type table<string, boolean>
require('vim.termcap').query({ 'Tc', 'RGB', 'setrgbf', 'setrgbb' }, function(cap, found)
if not found then

View File

@@ -1921,7 +1921,7 @@ function vim.api.nvim_set_current_win(window) end
--- Note: this function should not be called often. Rather, the callbacks
--- themselves can be used to throttle unneeded callbacks. the `on_start`
--- callback can return `false` to disable the provider until the next redraw.
--- Similarly, return `false` in `on_win` will skip the `on_lines` calls for
--- Similarly, return `false` in `on_win` will skip the `on_line` calls for
--- that window (but any extmarks set in `on_win` will still be used). A
--- plugin managing multiple sources of decoration should ideally only set one
--- provider, and merge the sources internally. You can use multiple `ns_id`
@@ -1930,10 +1930,10 @@ function vim.api.nvim_set_current_win(window) end
--- Note: doing anything other than setting extmarks is considered
--- experimental. Doing things like changing options are not explicitly
--- forbidden, but is likely to have unexpected consequences (such as 100% CPU
--- consumption). doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
--- consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
--- quite dubious for the moment.
---
--- Note: It is not allowed to remove or update extmarks in 'on_line'
--- Note: It is not allowed to remove or update extmarks in `on_line`
--- callbacks.
---
--- @param ns_id integer Namespace id from `nvim_create_namespace()`

View File

@@ -2,7 +2,7 @@
error('Cannot require a meta file')
-- These types were taken from https://github.com/LuaCATS/lpeg
-- (based on revision e6789e28e5b91a4a277a2a03081d708c403a3e34)
-- (based on revision 33f4ff5343a64cf613a0634d70092fbc2b64291b)
-- with types being renamed to include the vim namespace and with some descriptions made less verbose.
--- @brief <pre>help
@@ -22,17 +22,18 @@ vim.lpeg = {}
--- @nodoc
--- @class vim.lpeg.Pattern
--- @operator len: vim.lpeg.Pattern
--- @operator unm: vim.lpeg.Pattern
--- @operator add(vim.lpeg.Pattern): vim.lpeg.Pattern
--- @operator sub(vim.lpeg.Pattern): vim.lpeg.Pattern
--- @operator mul(vim.lpeg.Pattern): vim.lpeg.Pattern
--- @operator mul(vim.lpeg.Capture): vim.lpeg.Pattern
--- @operator div(string): vim.lpeg.Capture
--- @operator div(number): vim.lpeg.Capture
--- @operator div(integer): vim.lpeg.Capture
--- @operator div(table): vim.lpeg.Capture
--- @operator div(function): vim.lpeg.Capture
--- @operator pow(number): vim.lpeg.Pattern
--- @operator mod(function): nil
--- @operator pow(integer): vim.lpeg.Pattern
--- @operator mod(function): vim.lpeg.Capture
local Pattern = {}
--- @alias vim.lpeg.Capture vim.lpeg.Pattern
@@ -55,11 +56,12 @@ local Pattern = {}
--- assert(pattern:match('1 hello') == nil)
--- ```
---
--- @param pattern vim.lpeg.Pattern
--- @param pattern vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param subject string
--- @param init? integer
--- @return integer|vim.lpeg.Capture|nil
function vim.lpeg.match(pattern, subject, init) end
--- @param ... any
--- @return any ...
function vim.lpeg.match(pattern, subject, init, ...) end
--- Matches the given `pattern` against the `subject` string. If the match succeeds, returns the
--- index in the subject of the first character after the match, or the captured values (if the
@@ -81,8 +83,9 @@ function vim.lpeg.match(pattern, subject, init) end
---
--- @param subject string
--- @param init? integer
--- @return integer|vim.lpeg.Capture|nil
function Pattern:match(subject, init) end
--- @param ... any
--- @return any ...
function Pattern:match(subject, init, ...) end
--- Returns the string `"pattern"` if the given value is a pattern, otherwise `nil`.
---
@@ -123,7 +126,7 @@ function vim.lpeg.P(value) end
--- Pattern `patt` must match only strings with some fixed length, and it cannot contain captures.
--- Like the `and` predicate, this pattern never consumes any input, independently of success or failure.
---
--- @param pattern vim.lpeg.Pattern
--- @param pattern vim.lpeg.Pattern|string|integer|boolean|table
--- @return vim.lpeg.Pattern
function vim.lpeg.B(pattern) end
@@ -163,7 +166,7 @@ function vim.lpeg.S(string) end
--- assert(b:match('(') == nil)
--- ```
---
--- @param v string|integer
--- @param v boolean|string|number|function|table|thread|userdata|lightuserdata
--- @return vim.lpeg.Pattern
function vim.lpeg.V(v) end
@@ -227,7 +230,7 @@ function vim.lpeg.locale(tab) end
--- assert(c == 'c')
--- ```
---
--- @param patt vim.lpeg.Pattern
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Capture
function vim.lpeg.C(patt) end
@@ -258,7 +261,7 @@ function vim.lpeg.Cc(...) end
--- `func(...func(func(C1, C2), C3)...,Cn)`, that is, it will fold (or accumulate, or reduce) the captures from
--- `patt` using function `func`. This capture assumes that `patt` should produce at least one capture with at
--- least one value (of any type), which becomes the initial value of an accumulator. (If you need a specific
--- initial value, you may prefix a constant captureto `patt`.) For each subsequent capture, LPeg calls `func`
--- initial value, you may prefix a constant capture to `patt`.) For each subsequent capture, LPeg calls `func`
--- with this accumulator as the first argument and all values produced by the capture as extra arguments;
--- the first result from this call becomes the new value for the accumulator. The final value of the accumulator
--- becomes the captured value.
@@ -273,7 +276,7 @@ function vim.lpeg.Cc(...) end
--- assert(sum:match('10,30,43') == 83)
--- ```
---
--- @param patt vim.lpeg.Pattern
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param func fun(acc, newvalue)
--- @return vim.lpeg.Capture
function vim.lpeg.Cf(patt, func) end
@@ -282,7 +285,7 @@ function vim.lpeg.Cf(patt, func) end
--- The group may be anonymous (if no name is given) or named with the given name (which
--- can be any non-nil Lua value).
---
--- @param patt vim.lpeg.Pattern
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param name? string
--- @return vim.lpeg.Capture
function vim.lpeg.Cg(patt, name) end
@@ -320,7 +323,7 @@ function vim.lpeg.Cp() end
--- assert(gsub('Hello, xxx!', 'xxx', 'World') == 'Hello, World!')
--- ```
---
--- @param patt vim.lpeg.Pattern
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Capture
function vim.lpeg.Cs(patt) end
@@ -329,7 +332,7 @@ function vim.lpeg.Cs(patt) end
--- Moreover, for each named capture group created by `patt`, the first value of the group is put into
--- the table with the group name as its key. The captured value is only the table.
---
--- @param patt vim.lpeg.Pattern|''
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @return vim.lpeg.Capture
function vim.lpeg.Ct(patt) end
@@ -343,7 +346,7 @@ function vim.lpeg.Ct(patt) end
--- (so, to return true is equivalent to return `i`). If the call returns `false`, `nil`, or no value, the match fails.
--- Any extra values returned by the function become the values produced by the capture.
---
--- @param patt vim.lpeg.Pattern
--- @param fn function
--- @param patt vim.lpeg.Pattern|string|integer|boolean|table|function
--- @param fn fun(s: string, i: integer, ...: any): (position: boolean|integer, ...: any)
--- @return vim.lpeg.Capture
function vim.lpeg.Cmt(patt, fn) end

View File

@@ -544,7 +544,7 @@ vim.wo.bri = vim.wo.breakindent
--- applying 'breakindent', even if the resulting
--- text should normally be narrower. This prevents
--- text indented almost to the right window border
--- occupying lot of vertical space when broken.
--- occupying lots of vertical space when broken.
--- (default: 20)
--- shift:{n} After applying 'breakindent', the wrapped line's
--- beginning will be shifted by the given number of
@@ -3330,7 +3330,7 @@ vim.go.is = vim.go.incsearch
--- in Insert mode as specified with the 'indentkeys' option.
--- When this option is not empty, it overrules the 'cindent' and
--- 'smartindent' indenting. When 'lisp' is set, this option is
--- is only used when 'lispoptions' contains "expr:1".
--- only used when 'lispoptions' contains "expr:1".
--- The expression is evaluated with `v:lnum` set to the line number for
--- which the indent is to be computed. The cursor is also in this line
--- when the expression is evaluated (but it may be moved around).
@@ -3628,7 +3628,7 @@ vim.go.kp = vim.go.keywordprg
--- part can be in one of two forms:
--- 1. A list of pairs. Each pair is a "from" character immediately
--- followed by the "to" character. Examples: "aA", "aAbBcC".
--- 2. A list of "from" characters, a semi-colon and a list of "to"
--- 2. A list of "from" characters, a semicolon and a list of "to"
--- characters. Example: "abc;ABC"
--- Example: "aA,fgh;FGH,cCdDeE"
--- Special characters need to be preceded with a backslash. These are
@@ -3720,7 +3720,7 @@ vim.go.ls = vim.go.laststatus
--- update use `:redraw`.
--- This may occasionally cause display errors. It is only meant to be set
--- temporarily when performing an operation where redrawing may cause
--- flickering or cause a slow down.
--- flickering or cause a slowdown.
---
--- @type boolean
vim.o.lazyredraw = false
@@ -3820,6 +3820,9 @@ vim.go.lw = vim.go.lispwords
--- between tabs and spaces and for trailing blanks. Further changed by
--- the 'listchars' option.
---
--- When 'listchars' does not contain "tab" field, tabs are shown as "^I"
--- or "<09>", like how unprintable characters are displayed.
---
--- The cursor is displayed at the start of the space a Tab character
--- occupies, not at the end as usual in Normal mode. To get this cursor
--- position while displaying Tabs with spaces, use:
@@ -4757,7 +4760,7 @@ vim.go.pm = vim.go.patchmode
--- ```
--- To use an environment variable, you probably need to replace the
--- separator. Here is an example to append $INCL, in which directory
--- names are separated with a semi-colon:
--- names are separated with a semicolon:
---
--- ```vim
--- let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
@@ -5764,7 +5767,7 @@ vim.bo.shiftwidth = vim.o.shiftwidth
vim.bo.sw = vim.bo.shiftwidth
--- This option helps to avoid all the `hit-enter` prompts caused by file
--- messages, for example with CTRL-G, and to avoid some other messages.
--- messages, for example with CTRL-G, and to avoid some other messages.
--- It is a list of flags:
--- flag meaning when present ~
--- l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
@@ -6249,7 +6252,7 @@ vim.bo.spo = vim.bo.spelloptions
--- minus two.
---
--- timeout:{millisec} Limit the time searching for suggestions to
--- {millisec} milli seconds. Applies to the following
--- {millisec} milliseconds. Applies to the following
--- methods. When omitted the limit is 5000. When
--- negative there is no limit.
---

View File

@@ -3569,8 +3569,8 @@ function vim.fn.getreginfo(regname) end
--- difference if the buffer is displayed in a window with
--- different 'virtualedit' or 'list' values.
---
--- Examples: >
--- :xnoremap <CR>
--- Examples: >vim
--- xnoremap <CR>
--- \ <Cmd>echom getregion(
--- \ getpos('v'), getpos('.'), #{ type: mode() })<CR>
--- <
@@ -4233,7 +4233,7 @@ function vim.fn.iconv(string, from, to) end
--- Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
--- `v:_null_blob` have the same `id()` with different types
--- because they are internally represented as NULL pointers.
--- `id()` returns a hexadecimal representanion of the pointers to
--- `id()` returns a hexadecimal representation of the pointers to
--- the containers (i.e. like `0x994a40`), same as `printf("%p",
--- {expr})`, but it is advised against counting on the exact
--- format of the return value.
@@ -5538,19 +5538,19 @@ function vim.fn.matcharg(nr) end
---
--- Examples: >vim
--- " Assuming line 3 in buffer 5 contains "a"
--- :echo matchbufline(5, '\<\k\+\>', 3, 3)
--- [{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
--- echo matchbufline(5, '\<\k\+\>', 3, 3)
--- < `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
--- " Assuming line 4 in buffer 10 contains "tik tok"
--- :echo matchbufline(10, '\<\k\+\>', 1, 4)
--- [{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
--- <
--- echo matchbufline(10, '\<\k\+\>', 1, 4)
--- < `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
---
--- If {submatch} is present and is v:true, then submatches like
--- "\1", "\2", etc. are also returned. Example: >vim
--- " Assuming line 2 in buffer 2 contains "acd"
--- :echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
--- echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
--- \ {'submatches': v:true})
--- [{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
--- <The "submatches" List always contains 9 items. If a submatch
--- < `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
--- The "submatches" List always contains 9 items. If a submatch
--- is not found, then an empty string is returned for that
--- submatch.
---
@@ -5749,17 +5749,17 @@ function vim.fn.matchstr(expr, pat, start, count) end
--- option settings on the pattern.
---
--- Example: >vim
--- :echo matchstrlist(['tik tok'], '\<\k\+\>')
--- [{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
--- :echo matchstrlist(['a', 'b'], '\<\k\+\>')
--- [{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
--- <
--- echo matchstrlist(['tik tok'], '\<\k\+\>')
--- < `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
--- echo matchstrlist(['a', 'b'], '\<\k\+\>')
--- < `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
---
--- If "submatches" is present and is v:true, then submatches like
--- "\1", "\2", etc. are also returned. Example: >vim
--- :echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
--- echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
--- \ #{submatches: v:true})
--- [{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
--- <The "submatches" List always contains 9 items. If a submatch
--- < `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
--- The "submatches" List always contains 9 items. If a submatch
--- is not found, then an empty string is returned for that
--- submatch.
---
@@ -7199,7 +7199,7 @@ function vim.fn.screenchars(row, col) end
--- the following mappings: >vim
--- nnoremap <expr> GG ":echom " .. screencol() .. "\n"
--- nnoremap <silent> GG :echom screencol()<CR>
--- noremap GG <Cmd>echom screencol()<Cr>
--- noremap GG <Cmd>echom screencol()<CR>
--- <
---
--- @return any

View File

@@ -594,7 +594,7 @@ function M.frm(_, bufnr)
end
--- @type vim.filetype.mapfn
function M.fvwm_1(_, _)
function M.fvwm_v1(_, _)
return 'fvwm', function(bufnr)
vim.b[bufnr].fvwm_version = 1
end
@@ -1331,7 +1331,7 @@ end
function M.sgml(_, bufnr)
local lines = table.concat(getlines(bufnr, 1, 5))
if lines:find('linuxdoc') then
return 'smgllnx'
return 'sgmllnx'
elseif lines:find('<!DOCTYPE.*DocBook') then
return 'docbk',
function(b)

View File

@@ -328,8 +328,11 @@ function M.find(names, opts)
return matches
end
--- Find the first parent directory containing a specific "marker", relative to a buffer's
--- directory.
--- Find the first parent directory containing a specific "marker", relative to a file path or
--- buffer.
---
--- If the buffer is unnamed (has no backing file) or has a non-empty 'buftype' then the search
--- begins from Nvim's |current-directory|.
---
--- Example:
---
@@ -346,13 +349,13 @@ end
--- end)
--- ```
---
--- @param source integer|string Buffer number (0 for current buffer) or file path to begin the
--- search from.
--- @param source integer|string Buffer number (0 for current buffer) or file path (absolute or
--- relative to the |current-directory|) to begin the search from.
--- @param marker (string|string[]|fun(name: string, path: string): boolean) A marker, or list
--- of markers, to search for. If a function, the function is called for each
--- evaluated item and should return true if {name} and {path} are a match.
--- @return string? # Directory path containing one of the given markers, or nil if no directory was
--- found.
--- found.
function M.root(source, marker)
assert(source, 'missing required argument: source')
assert(marker, 'missing required argument: marker')
@@ -361,14 +364,18 @@ function M.root(source, marker)
if type(source) == 'string' then
path = source
elseif type(source) == 'number' then
path = vim.api.nvim_buf_get_name(source)
if vim.bo[source].buftype ~= '' then
path = assert(vim.uv.cwd())
else
path = vim.api.nvim_buf_get_name(source)
end
else
error('invalid type for argument "source": expected string or buffer number')
end
local paths = M.find(marker, {
upward = true,
path = path,
path = vim.fn.fnamemodify(path, ':p:h'),
})
if #paths == 0 then

View File

@@ -306,7 +306,7 @@ function M.system(cmd, args)
if jobid < 1 then
local message =
string.format('Command error (job=%d): %s (in %s)', jobid, shellify(cmd), vim.loop.cwd())
string.format('Command error (job=%d): %s (in %s)', jobid, shellify(cmd), vim.uv.cwd())
error(message)
return opts.output, 1
end
@@ -325,7 +325,7 @@ function M.system(cmd, args)
jobid,
shell_error_code,
shellify(cmd),
vim.loop.cwd()
vim.uv.cwd()
)
if opts.output:find('%S') then
emsg = string.format('%s\noutput: %s', emsg, opts.output)

View File

@@ -64,6 +64,8 @@ lsp._request_name_to_capability = {
[ms.textDocument_inlayHint] = { 'inlayHintProvider' },
[ms.textDocument_diagnostic] = { 'diagnosticProvider' },
[ms.inlayHint_resolve] = { 'inlayHintProvider', 'resolveProvider' },
[ms.textDocument_documentLink] = { 'documentLinkProvider' },
[ms.documentLink_resolve] = { 'documentLinkProvider', 'resolveProvider' },
}
-- TODO improve handling of scratch buffers with LSP attached.
@@ -373,7 +375,7 @@ local function reset_defaults(bufnr)
end
api.nvim_buf_call(bufnr, function()
local keymap = vim.fn.maparg('K', 'n', false, true)
if keymap and keymap.callback == vim.lsp.buf.hover then
if keymap and keymap.callback == vim.lsp.buf.hover and keymap.buffer == 1 then
vim.keymap.del('n', 'K', { buffer = bufnr })
end
end)
@@ -385,8 +387,8 @@ end
local function on_client_exit(code, signal, client_id)
local client = all_clients[client_id]
for bufnr in pairs(client.attached_buffers) do
vim.schedule(function()
vim.schedule(function()
for bufnr in pairs(client.attached_buffers) do
if client and client.attached_buffers[bufnr] then
api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
@@ -395,15 +397,16 @@ local function on_client_exit(code, signal, client_id)
})
end
local namespace = vim.lsp.diagnostic.get_namespace(client_id)
vim.diagnostic.reset(namespace, bufnr)
client.attached_buffers[bufnr] = nil
if #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0 then
reset_defaults(bufnr)
end
end)
end
end
local namespace = vim.lsp.diagnostic.get_namespace(client_id)
vim.diagnostic.reset(namespace)
end)
local name = client.name or 'unknown'
@@ -495,6 +498,29 @@ local function text_document_did_save_handler(bufnr)
end
end
---@param bufnr integer resolved buffer
---@param client vim.lsp.Client
local function buf_detach_client(bufnr, client)
api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
modeline = false,
data = { client_id = client.id },
})
changetracking.reset_buf(client, bufnr)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
local uri = vim.uri_from_bufnr(bufnr)
local params = { textDocument = { uri = uri } }
client.notify(ms.textDocument_didClose, params)
end
client.attached_buffers[bufnr] = nil
local namespace = lsp.diagnostic.get_namespace(client.id)
vim.diagnostic.reset(namespace, bufnr)
end
--- @type table<integer,true>
local attached_buffers = {}
@@ -547,36 +573,34 @@ local function buf_attach(bufnr)
api.nvim_buf_attach(bufnr, false, {
on_lines = function(_, _, changedtick, firstline, lastline, new_lastline)
if #lsp.get_clients({ bufnr = bufnr }) == 0 then
return true -- detach
-- detach if there are no clients
return #lsp.get_clients({ bufnr = bufnr, _uninitialized = true }) == 0
end
util.buf_versions[bufnr] = changedtick
changetracking.send_changes(bufnr, firstline, lastline, new_lastline)
end,
on_reload = function()
local clients = lsp.get_clients({ bufnr = bufnr })
local params = { textDocument = { uri = uri } }
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
for _, client in ipairs(clients) do
changetracking.reset_buf(client, bufnr)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify(ms.textDocument_didClose, params)
end
end
for _, client in ipairs(clients) do
client:_text_document_did_open_handler(bufnr)
end
end,
on_detach = function()
local params = { textDocument = { uri = uri } }
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
changetracking.reset_buf(client, bufnr)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
client.notify(ms.textDocument_didClose, params)
end
local clients = lsp.get_clients({ bufnr = bufnr, _uninitialized = true })
for _, client in ipairs(clients) do
buf_detach_client(bufnr, client)
end
for _, client in ipairs(all_clients) do
client.attached_buffers[bufnr] = nil
end
util.buf_versions[bufnr] = nil
attached_buffers[bufnr] = nil
util.buf_versions[bufnr] = nil
end,
-- TODO if we know all of the potential clients ahead of time, then we
@@ -650,27 +674,9 @@ function lsp.buf_detach_client(bufnr, client_id)
)
)
return
else
buf_detach_client(bufnr, client)
end
api.nvim_exec_autocmds('LspDetach', {
buffer = bufnr,
modeline = false,
data = { client_id = client_id },
})
changetracking.reset_buf(client, bufnr)
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
local uri = vim.uri_from_bufnr(bufnr)
local params = { textDocument = { uri = uri } }
client.notify(ms.textDocument_didClose, params)
end
client.attached_buffers[bufnr] = nil
util.buf_versions[bufnr] = nil
local namespace = lsp.diagnostic.get_namespace(client_id)
vim.diagnostic.reset(namespace, bufnr)
end
--- Checks if a buffer is attached for a particular client.
@@ -844,17 +850,20 @@ api.nvim_create_autocmd('VimLeavePre', {
---@param params table|nil Parameters to send to the server
---@param handler? lsp.Handler See |lsp-handler|
--- If nil, follows resolution strategy defined in |lsp-handler-configuration|
---
---@param on_unsupported? fun()
--- The function to call when the buffer has no clients that support the given method.
--- Defaults to an `ERROR` level notification.
---@return table<integer, integer> client_request_ids Map of client-id:request-id pairs
---for all successful requests.
---@return function _cancel_all_requests Function which can be used to
---cancel all the requests. You could instead
---iterate all clients and call their `cancel_request()` methods.
function lsp.buf_request(bufnr, method, params, handler)
function lsp.buf_request(bufnr, method, params, handler, on_unsupported)
validate({
bufnr = { bufnr, 'n', true },
method = { method, 's' },
handler = { handler, 'f', true },
on_unsupported = { on_unsupported, 'f', true },
})
bufnr = resolve_bufnr(bufnr)
@@ -876,7 +885,11 @@ function lsp.buf_request(bufnr, method, params, handler)
-- if has client but no clients support the given method, notify the user
if next(clients) and not method_supported then
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
if on_unsupported == nil then
vim.notify(lsp._unsupported_method(method), vim.log.levels.ERROR)
else
on_unsupported()
end
vim.cmd.redraw()
return {}, function() end
end

View File

@@ -182,7 +182,7 @@ local validate = vim.validate
--- It can be `null` if the client supports workspace folders but none are
--- configured.
--- @field workspace_folders lsp.WorkspaceFolder[]?
--- @field root_dir string
--- @field root_dir string?
---
--- @field attached_buffers table<integer,true>
---
@@ -470,7 +470,6 @@ function Client.create(config)
_on_exit_cbs = ensure_list(config.on_exit),
_on_attach_cbs = ensure_list(config.on_attach),
_on_error_cb = config.on_error,
_root_dir = config.root_dir,
_trace = get_trace(config.trace),
--- Contains $/progress report messages.
@@ -612,7 +611,10 @@ function Client:initialize()
self:_run_callbacks(self._on_init_cbs, lsp.client_errors.ON_INIT_CALLBACK_ERROR, self, result)
for buf in pairs(reattach_bufs) do
self:_on_attach(buf)
-- The buffer may have been detached in the on_init callback.
if self.attached_buffers[buf] then
self:_on_attach(buf)
end
end
log.info(

View File

@@ -164,7 +164,7 @@ function M.display(lenses, bufnr, client_id)
return a.range.start.character < b.range.start.character
end)
for j, lens in ipairs(line_lenses) do
local text = lens.command and lens.command.title or 'Unresolved lens ...'
local text = (lens.command and lens.command.title or 'Unresolved lens ...'):gsub('%s+', ' ')
table.insert(chunks, { text, 'LspCodeLens' })
if j < num_line_lenses then
table.insert(chunks, { ' | ', 'LspCodeLensSeparator' })
@@ -307,7 +307,13 @@ function M.refresh(opts)
}
active_refreshes[buf] = true
local request_ids = vim.lsp.buf_request(buf, ms.textDocument_codeLens, params, M.on_codelens)
local request_ids = vim.lsp.buf_request(
buf,
ms.textDocument_codeLens,
params,
M.on_codelens,
function() end
)
if vim.tbl_isempty(request_ids) then
active_refreshes[buf] = nil
end

View File

@@ -33,16 +33,25 @@ local function check_active_clients()
local clients = vim.lsp.get_clients()
if next(clients) then
for _, client in pairs(clients) do
local attached_to = table.concat(vim.tbl_keys(client.attached_buffers or {}), ',')
report_info(
local cmd ---@type string
if type(client.config.cmd) == 'table' then
cmd = table.concat(client.config.cmd --[[@as table]], ' ')
elseif type(client.config.cmd) == 'function' then
cmd = tostring(client.config.cmd)
end
report_info(table.concat({
string.format('%s (id: %d)', client.name, client.id),
string.format(
'%s (id=%s, root_dir=%s, attached_to=[%s])',
client.name,
client.id,
vim.fn.fnamemodify(client.root_dir, ':~'),
attached_to
)
)
' Root directory: %s',
client.root_dir and vim.fn.fnamemodify(client.root_dir, ':~') or nil
),
string.format(' Command: %s', cmd),
string.format(' Settings: %s', vim.inspect(client.settings, { newline = '\n ' })),
string.format(
' Attached buffers: %s',
vim.iter(pairs(client.attached_buffers)):map(tostring):join(', ')
),
}, '\n'))
end
else
report_info('No active clients')
@@ -50,7 +59,7 @@ local function check_active_clients()
end
local function check_watcher()
vim.health.start('vim.lsp: File watcher')
vim.health.start('vim.lsp: File Watcher')
-- Only run the check if file watching has been enabled by a client.
local clients = vim.lsp.get_clients()
@@ -94,11 +103,68 @@ local function check_watcher()
end
end
local function check_position_encodings()
vim.health.start('vim.lsp: Position Encodings')
local clients = vim.lsp.get_clients()
if next(clients) then
local position_encodings = {} ---@type table<integer, table<string, integer[]>>
for _, client in pairs(clients) do
for bufnr in pairs(client.attached_buffers) do
if not position_encodings[bufnr] then
position_encodings[bufnr] = {}
end
if not position_encodings[bufnr][client.offset_encoding] then
position_encodings[bufnr][client.offset_encoding] = {}
end
table.insert(position_encodings[bufnr][client.offset_encoding], client.id)
end
end
-- Check if any buffers are attached to multiple clients with different position encodings
local buffers = {} ---@type integer[]
for bufnr, encodings in pairs(position_encodings) do
local list = {} ---@type string[]
for k in pairs(encodings) do
list[#list + 1] = k
end
if #list > 1 then
buffers[#buffers + 1] = bufnr
end
end
if #buffers > 0 then
local lines =
{ 'Found buffers attached to multiple clients with different position encodings.' }
for _, bufnr in ipairs(buffers) do
local encodings = position_encodings[bufnr]
local parts = {}
for encoding, client_ids in pairs(encodings) do
table.insert(
parts,
string.format('%s (client id(s): %s)', encoding:upper(), table.concat(client_ids, ', '))
)
end
table.insert(lines, string.format('- Buffer %d: %s', bufnr, table.concat(parts, ', ')))
end
report_warn(
table.concat(lines, '\n'),
'Use the positionEncodings client capability to ensure all clients use the same position encoding'
)
else
report_info('No buffers contain mixed position encodings')
end
else
report_info('No active clients')
end
end
--- Performs a healthcheck for LSP
function M.check()
check_log()
check_active_clients()
check_watcher()
check_position_encodings()
end
return M

View File

@@ -336,6 +336,8 @@ api.nvim_set_decoration_provider(namespace, {
for lnum = topline, botline do
if bufstate.applied[lnum] ~= bufstate.version then
api.nvim_buf_clear_namespace(bufnr, namespace, lnum, lnum + 1)
local hint_virtual_texts = {} --- @type table<integer, [string, string?][]>
for _, lnum_hints in pairs(client_hints) do
local hints = lnum_hints[lnum] or {}
for _, hint in pairs(hints) do
@@ -348,7 +350,7 @@ api.nvim_set_decoration_provider(namespace, {
text = text .. part.value
end
end
local vt = {} --- @type {[1]: string, [2]: string?}[]
local vt = hint_virtual_texts[hint.position.character] or {}
if hint.paddingLeft then
vt[#vt + 1] = { ' ' }
end
@@ -356,13 +358,18 @@ api.nvim_set_decoration_provider(namespace, {
if hint.paddingRight then
vt[#vt + 1] = { ' ' }
end
api.nvim_buf_set_extmark(bufnr, namespace, lnum, hint.position.character, {
virt_text_pos = 'inline',
ephemeral = false,
virt_text = vt,
})
hint_virtual_texts[hint.position.character] = vt
end
end
for pos, vt in pairs(hint_virtual_texts) do
api.nvim_buf_set_extmark(bufnr, namespace, lnum, pos, {
virt_text_pos = 'inline',
ephemeral = false,
virt_text = vt,
})
end
bufstate.applied[lnum] = bufstate.version
end
end
@@ -370,7 +377,7 @@ api.nvim_set_decoration_provider(namespace, {
})
--- Query whether inlay hint is enabled in the {filter}ed scope
--- @param filter vim.lsp.inlay_hint.enable.Filter
--- @param filter? vim.lsp.inlay_hint.enable.Filter
--- @return boolean
--- @since 12
function M.is_enabled(filter)

View File

@@ -197,12 +197,6 @@ function STHighlighter.new(bufnr)
highlighter:send_request()
end
end,
on_detach = function(_, buf)
local highlighter = STHighlighter.active[buf]
if highlighter then
highlighter:destroy()
end
end,
})
api.nvim_create_autocmd({ 'BufWinEnter', 'InsertLeave' }, {

View File

@@ -315,7 +315,7 @@ local function select_tabstop(tabstop)
move_cursor_to(range[1] + 1, range[2] + 1)
feedkeys('v')
move_cursor_to(range[3] + 1, range[4])
feedkeys('o<c-g>')
feedkeys('o<c-g><c-r>_')
end
end
@@ -395,6 +395,15 @@ local function setup_autocmds(bufnr)
end
end,
})
vim.api.nvim_create_autocmd('BufLeave', {
group = snippet_group,
desc = 'Stop the snippet session when leaving the buffer',
buffer = bufnr,
callback = function()
M.stop()
end,
})
end
--- Expands the given snippet text.
@@ -444,7 +453,7 @@ function M.expand(input)
local snippet_lines = text_to_lines(snippet_text)
-- Get the base indentation based on the current line and the last line of the snippet.
if #snippet_lines > 0 then
base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s*)%S') or '') --- @type string
base_indent = base_indent .. (snippet_lines[#snippet_lines]:match('(^%s+)%S') or '') --- @type string
end
local shiftwidth = vim.fn.shiftwidth()

View File

@@ -18,15 +18,19 @@ end
--- Hex decode a string.
---
--- @param enc string String to decode
--- @return string : Decoded string
--- @return string? : Decoded string
--- @return string? : Error message, if any
function M.hexdecode(enc)
assert(#enc % 2 == 0, 'string must have an even number of hex characters')
if #enc % 2 ~= 0 then
return nil, 'string must have an even number of hex characters'
end
local str = {} ---@type string[]
for i = 1, #enc, 2 do
local n = assert(tonumber(enc:sub(i, i + 1), 16))
str[#str + 1] = string.char(n)
end
return table.concat(str)
return table.concat(str), nil
end
return M

View File

@@ -40,7 +40,8 @@ end
local function guess_query_lang(buf)
local filename = api.nvim_buf_get_name(buf)
if filename ~= '' then
return vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
local resolved_filename = vim.F.npcall(vim.fn.fnamemodify, filename, ':p:h:t')
return resolved_filename and vim.treesitter.language.get_lang(resolved_filename) or nil
end
end

View File

@@ -220,14 +220,13 @@ function TSTreeView:draw(bufnr)
local text ---@type string
if item.node:named() then
if item.field then
text = string.format('%s: (%s', item.field, item.node:type())
else
text = string.format('(%s', item.node:type())
end
text = string.format('(%s', item.node:type())
else
text = string.format('%q', item.node:type()):gsub('\n', 'n')
end
if item.field then
text = string.format('%s: %s', item.field, text)
end
local next = self:get(i + 1)
if not next or next.depth <= item.depth then

View File

@@ -139,8 +139,11 @@ function TSHighlighter.new(tree, opts)
-- but use synload.vim rather than syntax.vim to not enable
-- syntax FileType autocmds. Later on we should integrate with the
-- `:syntax` and `set syntax=...` machinery properly.
-- Still need to ensure that syntaxset augroup exists, so that calling :destroy()
-- immediately afterwards will not error.
if vim.g.syntax_on ~= 1 then
vim.cmd.runtime({ 'syntax/synload.vim', bang = true })
vim.api.nvim_create_augroup('syntaxset', { clear = false })
end
api.nvim_buf_call(self.bufnr, function()
@@ -377,11 +380,15 @@ function TSHighlighter._on_spell_nav(_, _, buf, srow, _, erow, _)
return
end
-- Do not affect potentially populated highlight state. Here we just want a temporary
-- empty state so the C code can detect whether the region should be spell checked.
local highlight_states = self._highlight_states
self:prepare_highlight_states(srow, erow)
for row = srow, erow do
on_line_impl(self, buf, row, true)
end
self._highlight_states = highlight_states
end
---@private

View File

@@ -136,7 +136,7 @@ function M.open(path)
})
local is_uri = path:match('%w+:')
if not is_uri then
path = vim.fn.expand(path)
path = vim.fs.normalize(path)
end
local cmd --- @type string[]

View File

@@ -26,6 +26,7 @@
</screenshots>
<releases>
<release date="2024-07-24" version="0.10.1"/>
<release date="2024-05-16" version="0.10.0"/>
<release date="2023-12-30" version="0.9.5"/>
<release date="2023-10-09" version="0.9.4"/>

View File

@@ -1,6 +1,6 @@
" Vim plugin for showing matching parens
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2023 Oct 20
" Last Change: 2024 May 18
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Exit quickly when:
@@ -218,7 +218,7 @@ command NoMatchParen call s:NoMatchParen()
func s:NoMatchParen()
let w = winnr()
noau windo silent! call matchdelete(3)
noau windo call s:Remove_Matches()
unlet! g:loaded_matchparen
exe "noau ". w . "wincmd w"
au! matchparen

View File

@@ -5,8 +5,8 @@ vim.g.loaded_2html_plugin = true
vim.api.nvim_create_user_command('TOhtml', function(args)
local outfile = args.args ~= '' and args.args or vim.fn.tempname() .. '.html'
local html = require('tohtml').tohtml()
local html = require('tohtml').tohtml(0, { range = { args.line1, args.line2 } })
vim.fn.writefile(html, outfile)
vim.cmd.split(outfile)
vim.bo.filetype = 'html'
end, { bar = true, nargs = '?' })
end, { bar = true, nargs = '?', range = '%' })

View File

@@ -1,9 +0,0 @@
[
(function_definition)
(if_statement)
(case_statement)
(for_statement)
(while_statement)
(c_style_for_statement)
(heredoc_redirect)
] @fold

View File

@@ -1,232 +0,0 @@
[
"("
")"
"{"
"}"
"["
"]"
"[["
"]]"
"(("
"))"
] @punctuation.bracket
[
";"
";;"
";&"
";;&"
"&"
] @punctuation.delimiter
[
">"
">>"
"<"
"<<"
"&&"
"|"
"|&"
"||"
"="
"+="
"=~"
"=="
"!="
"&>"
"&>>"
"<&"
">&"
">|"
"<&-"
">&-"
"<<-"
"<<<"
".."
"!"
] @operator
; Do *not* spell check strings since they typically have some sort of
; interpolation in them, or, are typically used for things like filenames, URLs,
; flags and file content.
[
(string)
(raw_string)
(ansi_c_string)
(heredoc_body)
] @string
[
(heredoc_start)
(heredoc_end)
] @label
(variable_assignment
(word) @string)
(command
argument: "$" @string) ; bare dollar
(concatenation
(word) @string)
[
"if"
"then"
"else"
"elif"
"fi"
"case"
"in"
"esac"
] @keyword.conditional
[
"for"
"do"
"done"
"select"
"until"
"while"
] @keyword.repeat
[
"declare"
"typeset"
"export"
"readonly"
"local"
"unset"
"unsetenv"
] @keyword
"function" @keyword.function
(special_variable_name) @constant
; trap -l
((word) @constant.builtin
(#any-of? @constant.builtin
"SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
"SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
"SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
"SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
"SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
"SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
"SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
"SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
((word) @boolean
(#any-of? @boolean "true" "false"))
(comment) @comment @spell
(test_operator) @operator
(command_substitution
"$(" @punctuation.special
")" @punctuation.special)
(process_substitution
[
"<("
">("
] @punctuation.special
")" @punctuation.special)
(arithmetic_expansion
[
"$(("
"(("
] @punctuation.special
"))" @punctuation.special)
(arithmetic_expansion
"," @punctuation.delimiter)
(ternary_expression
[
"?"
":"
] @keyword.conditional.ternary)
(binary_expression
operator: _ @operator)
(unary_expression
operator: _ @operator)
(postfix_expression
operator: _ @operator)
(function_definition
name: (word) @function)
(command_name
(word) @function.call)
(command_name
(word) @function.builtin
(#any-of? @function.builtin
"alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt"
"continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "fc" "fg" "getopts"
"hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf" "pushd" "pwd"
"read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time" "times"
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
(command
argument: [
(word) @variable.parameter
(concatenation
(word) @variable.parameter)
])
(number) @number
((word) @number
(#lua-match? @number "^[0-9]+$"))
(file_redirect
destination: (word) @variable.parameter)
(file_descriptor) @operator
(simple_expansion
"$" @punctuation.special) @none
(expansion
"${" @punctuation.special
"}" @punctuation.special) @none
(expansion
operator: _ @punctuation.special)
(expansion
"@"
.
operator: _ @character.special)
((expansion
(subscript
index: (word) @character.special))
(#any-of? @character.special "@" "*"))
"``" @punctuation.special
(variable_name) @variable
((variable_name) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
(case_item
value: (word) @variable.parameter)
[
(regex)
(extglob_pattern)
] @string.regexp
((program
.
(comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/"))

View File

@@ -1,3 +0,0 @@
(heredoc_redirect
(heredoc_body) @injection.content
(heredoc_end) @injection.language)

View File

@@ -1,28 +0,0 @@
[
(function_definition)
(class_definition)
(while_statement)
(for_statement)
(if_statement)
(with_statement)
(try_statement)
(match_statement)
(import_from_statement)
(parameters)
(argument_list)
(parenthesized_expression)
(generator_expression)
(list_comprehension)
(set_comprehension)
(dictionary_comprehension)
(tuple)
(list)
(set)
(dictionary)
(string)
] @fold
[
(import_statement)
(import_from_statement)
]+ @fold

View File

@@ -1,457 +0,0 @@
; From tree-sitter-python licensed under MIT License
; Copyright (c) 2016 Max Brunsfeld
; Variables
(identifier) @variable
; Reset highlighting in f-string interpolations
(interpolation) @none
; Identifier naming conventions
((identifier) @type
(#lua-match? @type "^[A-Z].*[a-z]"))
((identifier) @constant
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
((identifier) @constant.builtin
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
((identifier) @constant.builtin
(#any-of? @constant.builtin
; https://docs.python.org/3/library/constants.html
"NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license"))
"_" @constant.builtin ; match wildcard
((attribute
attribute: (identifier) @variable.member)
(#lua-match? @variable.member "^[%l_].*$"))
((assignment
left: (identifier) @type.definition
(type
(identifier) @_annotation))
(#eq? @_annotation "TypeAlias"))
((assignment
left: (identifier) @type.definition
right: (call
function: (identifier) @_func))
(#any-of? @_func "TypeVar" "NewType"))
; Function calls
(call
function: (identifier) @function.call)
(call
function: (attribute
attribute: (identifier) @function.method.call))
((call
function: (identifier) @constructor)
(#lua-match? @constructor "^%u"))
((call
function: (attribute
attribute: (identifier) @constructor))
(#lua-match? @constructor "^%u"))
; Decorators
((decorator
"@" @attribute)
(#set! "priority" 101))
(decorator
(identifier) @attribute)
(decorator
(attribute
attribute: (identifier) @attribute))
(decorator
(call
(identifier) @attribute))
(decorator
(call
(attribute
attribute: (identifier) @attribute)))
((decorator
(identifier) @attribute.builtin)
(#any-of? @attribute.builtin "classmethod" "property" "staticmethod"))
; Builtin functions
((call
function: (identifier) @function.builtin)
(#any-of? @function.builtin
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
"classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
"filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
"input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
"min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
"round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
"vars" "zip" "__import__"))
; Function definitions
(function_definition
name: (identifier) @function)
(type
(identifier) @type)
(type
(subscript
(identifier) @type)) ; type subscript: Tuple[int]
((call
function: (identifier) @_isinstance
arguments: (argument_list
(_)
(identifier) @type))
(#eq? @_isinstance "isinstance"))
; Normal parameters
(parameters
(identifier) @variable.parameter)
; Lambda parameters
(lambda_parameters
(identifier) @variable.parameter)
(lambda_parameters
(tuple_pattern
(identifier) @variable.parameter))
; Default parameters
(keyword_argument
name: (identifier) @variable.parameter)
; Naming parameters on call-site
(default_parameter
name: (identifier) @variable.parameter)
(typed_parameter
(identifier) @variable.parameter)
(typed_default_parameter
name: (identifier) @variable.parameter)
; Variadic parameters *args, **kwargs
(parameters
(list_splat_pattern ; *args
(identifier) @variable.parameter))
(parameters
(dictionary_splat_pattern ; **kwargs
(identifier) @variable.parameter))
; Typed variadic parameters
(parameters
(typed_parameter
(list_splat_pattern ; *args: type
(identifier) @variable.parameter)))
(parameters
(typed_parameter
(dictionary_splat_pattern ; *kwargs: type
(identifier) @variable.parameter)))
; Lambda parameters
(lambda_parameters
(list_splat_pattern
(identifier) @variable.parameter))
(lambda_parameters
(dictionary_splat_pattern
(identifier) @variable.parameter))
; Literals
(none) @constant.builtin
[
(true)
(false)
] @boolean
((identifier) @variable.builtin
(#eq? @variable.builtin "self"))
((identifier) @variable.builtin
(#eq? @variable.builtin "cls"))
(integer) @number
(float) @number.float
(comment) @comment @spell
((module
.
(comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/"))
(string) @string
[
(escape_sequence)
(escape_interpolation)
] @string.escape
; doc-strings
(module
.
(comment)*
.
(expression_statement
(string) @string.documentation))
(class_definition
body: (block
.
(expression_statement
(string) @string.documentation)))
(function_definition
body: (block
.
(expression_statement
(string) @string.documentation)))
(module
.
(comment)*
.
(expression_statement
(string
(string_content) @spell)))
(class_definition
body: (block
.
(expression_statement
(string
(string_content) @spell))))
(function_definition
body: (block
.
(expression_statement
(string
(string_content) @spell))))
; Tokens
[
"-"
"-="
":="
"!="
"*"
"**"
"**="
"*="
"/"
"//"
"//="
"/="
"&"
"&="
"%"
"%="
"^"
"^="
"+"
"+="
"<"
"<<"
"<<="
"<="
"<>"
"="
"=="
">"
">="
">>"
">>="
"@"
"@="
"|"
"|="
"~"
"->"
] @operator
; Keywords
[
"and"
"in"
"is"
"not"
"or"
"is not"
"not in"
"del"
] @keyword.operator
[
"def"
"lambda"
] @keyword.function
[
"assert"
"exec"
"global"
"nonlocal"
"pass"
"print"
"with"
"as"
] @keyword
[
"type"
"class"
] @keyword.type
[
"async"
"await"
] @keyword.coroutine
[
"return"
"yield"
] @keyword.return
(yield
"from" @keyword.return)
(future_import_statement
"from" @keyword.import
"__future__" @constant.builtin)
(import_from_statement
"from" @keyword.import)
"import" @keyword.import
(aliased_import
"as" @keyword.import)
[
"if"
"elif"
"else"
"match"
"case"
] @keyword.conditional
[
"for"
"while"
"break"
"continue"
] @keyword.repeat
[
"try"
"except"
"except*"
"raise"
"finally"
] @keyword.exception
(raise_statement
"from" @keyword.exception)
(try_statement
(else_clause
"else" @keyword.exception))
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(interpolation
"{" @punctuation.special
"}" @punctuation.special)
(type_conversion) @function.macro
[
","
"."
":"
";"
(ellipsis)
] @punctuation.delimiter
; Class definitions
(class_definition
name: (identifier) @type)
(class_definition
body: (block
(function_definition
name: (identifier) @function.method)))
(class_definition
superclasses: (argument_list
(identifier) @type))
((class_definition
body: (block
(expression_statement
(assignment
left: (identifier) @variable.member))))
(#lua-match? @variable.member "^[%l_].*$"))
((class_definition
body: (block
(expression_statement
(assignment
left: (_
(identifier) @variable.member)))))
(#lua-match? @variable.member "^[%l_].*$"))
((class_definition
(block
(function_definition
name: (identifier) @constructor)))
(#any-of? @constructor "__new__" "__init__"))
((identifier) @type.builtin
(#any-of? @type.builtin
; https://docs.python.org/3/library/exceptions.html
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
"AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
"ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
"NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
"StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
"SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
"UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
"IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
"BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
"FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
"NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
; https://docs.python.org/3/library/stdtypes.html
"bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview"
"set" "frozenset" "dict" "type" "object"))
; Regex from the `re` module
(call
function: (attribute
object: (identifier) @_re)
arguments: (argument_list
.
(string
(string_content) @string.regexp))
(#eq? @_re "re"))

View File

@@ -5,9 +5,6 @@
(capture
(identifier) @type)
(anonymous_node
(identifier) @string)
(predicate
name: (identifier) @function.call)

View File

@@ -1,13 +1,19 @@
(h1) @markup.heading.1
(h1
(delimiter) @markup.heading.1
(heading) @markup.heading.1)
(h2) @markup.heading.2
(h2
(delimiter) @markup.heading.2
(heading) @markup.heading.2)
(h3) @markup.heading.3
(column_heading) @markup.heading.4
(h3
(heading) @markup.heading.3)
(column_heading
"~" @markup.heading.4
(heading) @markup.heading.4)
(column_heading
(delimiter) @markup.heading.4
(#set! conceal ""))
(tag

View File

@@ -4,17 +4,7 @@
" Filenames: *.styl, *.stylus
" Based On: Tim Pope (sass.vim)
" Created: Dec 14, 2011
" Modified: Apr 29, 2024
if main_syntax == "css"
syn sync minlines=10
endif
" let b:current_syntax = "css"
"
if main_syntax == 'css'
unlet main_syntax
endif
" Modified: May 28, 2024
syn case ignore

View File

@@ -158,6 +158,9 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
# ENABLE_EXPORTS is set to true. See
# https://github.com/neovim/neovim/issues/25295
target_link_options(nvim_bin PRIVATE "-Wl,-export_dynamic")
# Apple Clang 16's new deduplication pass leads to lock-up on start
# TODO(clason): verify that problem remains after release or remove
target_link_options(nvim_bin PRIVATE "-Wl,-no_deduplicate")
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
target_link_libraries(main_lib INTERFACE pthread c++abi)
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
@@ -477,7 +480,6 @@ endif()
if(MSVC)
list(APPEND gen_cflags -wd4003)
endif()
list(APPEND gen_cflags -O2)
set(NVIM_VERSION_GIT_H ${PROJECT_BINARY_DIR}/cmake.config/auto/versiondef_git.h)
add_custom_target(update_version_stamp

View File

@@ -1011,7 +1011,7 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
/// Note: this function should not be called often. Rather, the callbacks
/// themselves can be used to throttle unneeded callbacks. the `on_start`
/// callback can return `false` to disable the provider until the next redraw.
/// Similarly, return `false` in `on_win` will skip the `on_lines` calls
/// Similarly, return `false` in `on_win` will skip the `on_line` calls
/// for that window (but any extmarks set in `on_win` will still be used).
/// A plugin managing multiple sources of decoration should ideally only set
/// one provider, and merge the sources internally. You can use multiple `ns_id`
@@ -1020,10 +1020,10 @@ void nvim_buf_clear_namespace(Buffer buffer, Integer ns_id, Integer line_start,
/// Note: doing anything other than setting extmarks is considered experimental.
/// Doing things like changing options are not explicitly forbidden, but is
/// likely to have unexpected consequences (such as 100% CPU consumption).
/// doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite dubious
/// Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is quite dubious
/// for the moment.
///
/// Note: It is not allowed to remove or update extmarks in 'on_line' callbacks.
/// Note: It is not allowed to remove or update extmarks in `on_line` callbacks.
///
/// @param ns_id Namespace id from |nvim_create_namespace()|
/// @param opts Table of callbacks:

View File

@@ -778,16 +778,26 @@ void remote_ui_raw_line(RemoteUI *ui, Integer grid, Integer row, Integer startco
for (size_t i = 0; i < ncells; i++) {
repeat++;
if (i == ncells - 1 || attrs[i] != attrs[i + 1] || chunk[i] != chunk[i + 1]) {
if (UI_BUF_SIZE - BUF_POS(ui) < 2 * (1 + 2 + MAX_SCHAR_SIZE + 5 + 5) + 1
if (
// Close to overflowing the redraw buffer. Finish this event, flush,
// and start a new "grid_line" event at the current position.
// For simplicity leave place for the final "clear" element as well,
// hence the factor of 2 in the check.
UI_BUF_SIZE - BUF_POS(ui) < 2 * (1 + 2 + MAX_SCHAR_SIZE + 5 + 5) + 1
// Also if there is a lot of packed cells, pass them off to the UI to
// let it start processing them.
|| ui->ncells_pending >= 500) {
// close to overflowing the redraw buffer. finish this event,
// flush, and start a new "grid_line" event at the current position.
// For simplicity leave place for the final "clear" element
// as well, hence the factor of 2 in the check.
// Also if there is a lot of packed cells, pass them of to the UI to
// let it start processing them
// If the last chunk was all spaces, add an empty clearing chunk,
// so it's clear that the last chunk wasn't a clearing chunk.
if (was_space) {
nelem++;
ui->ncells_pending += 1;
mpack_array(buf, 3);
mpack_str_small(buf, S_LEN(" "));
mpack_uint(buf, (uint32_t)clearattr);
mpack_uint(buf, 0);
}
mpack_w2(&lenpos, nelem);
// We only ever set the wrap field on the final "grid_line" event for the line.
mpack_bool(buf, false);
ui_flush_buf(ui);

View File

@@ -2384,8 +2384,8 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
}
}
int count = (win != NULL) + (buf != NULL);
VALIDATE(popcount(opts->is_set__redraw_) > count, "%s", "at least one action required", {
unsigned count = (win != NULL) + (buf != NULL);
VALIDATE(xpopcount(opts->is_set__redraw_) > count, "%s", "at least one action required", {
return;
});
@@ -2422,10 +2422,6 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
redraw_buf_range_later(rbuf, first, last);
}
if (opts->cursor) {
setcursor_mayforce(win ? win : curwin, true);
}
bool flush = opts->flush;
if (opts->tabline) {
// Flush later in case tabline was just hidden or shown for the first time.
@@ -2452,11 +2448,22 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
}
}
// Flush pending screen updates if "flush" or "clear" is true, or when
// redrawing a status component may have changed the grid dimensions.
win_T *cwin = win ? win : curwin;
// Allow moving cursor to recently opened window and make sure it is drawn #28868.
if (opts->cursor && (!cwin->w_grid.target || !cwin->w_grid.target->valid)) {
flush = true;
}
// Redraw pending screen updates when explicitly requested or when determined
// that it is necessary to properly draw other requested components.
if (flush && !cmdpreview) {
update_screen();
}
if (opts->cursor) {
setcursor_mayforce(cwin, true);
}
ui_flush();
RedrawingDisabled = save_rd;

View File

@@ -3242,6 +3242,7 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
/// Adds matches to `ga`.
/// If "dirs" is true only expand directory names.
void globpath(char *path, char *file, garray_T *ga, int expand_options, bool dirs)
FUNC_ATTR_NONNULL_ALL
{
expand_T xpc;
ExpandInit(&xpc);

View File

@@ -15,6 +15,7 @@
#include "nvim/drawscreen.h"
#include "nvim/extmark.h"
#include "nvim/fold.h"
#include "nvim/globals.h"
#include "nvim/grid.h"
#include "nvim/grid_defs.h"
#include "nvim/highlight.h"
@@ -30,9 +31,6 @@
# include "decoration.c.generated.h"
#endif
// TODO(bfredl): These should maybe be per-buffer, so that all resources
// associated with a buffer can be freed when the buffer is unloaded.
kvec_t(DecorSignHighlight) decor_items = KV_INITIAL_VALUE;
uint32_t decor_freelist = UINT32_MAX;
// Decorations might be requested to be deleted in a callback in the middle of redrawing.
@@ -184,6 +182,21 @@ void buf_put_decor(buf_T *buf, DecorInline decor, int row, int row2)
}
}
/// When displaying signs in the 'number' column, if the width of the number
/// column is less than 2, then force recomputing the width after placing or
/// unplacing the first sign in "buf".
static void may_force_numberwidth_recompute(buf_T *buf, bool unplace)
{
FOR_ALL_TAB_WINDOWS(tp, wp) {
if (wp->w_buffer == buf
&& wp->w_minscwidth == SCL_NUM
&& (wp->w_p_nu || wp->w_p_rnu)
&& (unplace || wp->w_nrwidth_width < 2)) {
wp->w_nrwidth_line_count = 0;
}
}
}
static int sign_add_id = 0;
void buf_put_decor_sh(buf_T *buf, DecorSignHighlight *sh, int row1, int row2)
{
@@ -191,6 +204,7 @@ void buf_put_decor_sh(buf_T *buf, DecorSignHighlight *sh, int row1, int row2)
sh->sign_add_id = sign_add_id++;
if (sh->text[0]) {
buf_signcols_count_range(buf, row1, row2, 1, kFalse);
may_force_numberwidth_recompute(buf, false);
}
}
}
@@ -218,6 +232,7 @@ void buf_remove_decor_sh(buf_T *buf, int row1, int row2, DecorSignHighlight *sh)
if (buf_meta_total(buf, kMTMetaSignText)) {
buf_signcols_count_range(buf, row1, row2, -1, kFalse);
} else {
may_force_numberwidth_recompute(buf, true);
buf->b_signcols.resized = true;
buf->b_signcols.max = buf->b_signcols.count[0] = 0;
}
@@ -274,7 +289,7 @@ static void decor_free_inner(DecorVirtText *vt, uint32_t first_idx)
while (idx != DECOR_ID_INVALID) {
DecorSignHighlight *sh = &kv_A(decor_items, idx);
if (sh->flags & kSHIsSign) {
xfree(sh->sign_name);
XFREE_CLEAR(sh->sign_name);
}
sh->flags = 0;
if (sh->url != NULL) {

View File

@@ -77,6 +77,9 @@ typedef struct {
} DecorState;
EXTERN DecorState decor_state INIT( = { 0 });
// TODO(bfredl): These should maybe be per-buffer, so that all resources
// associated with a buffer can be freed when the buffer is unloaded.
EXTERN kvec_t(DecorSignHighlight) decor_items INIT( = KV_INITIAL_VALUE);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "decoration.h.generated.h"

View File

@@ -212,9 +212,7 @@ void diff_buf_add(buf_T *buf)
semsg(_("E96: Cannot diff more than %" PRId64 " buffers"), (int64_t)DB_COUNT);
}
///
/// Remove all buffers to make diffs for.
///
static void diff_buf_clear(void)
{
for (int i = 0; i < DB_COUNT; i++) {
@@ -366,7 +364,6 @@ static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T
break;
}
//
// Check for these situations:
// 1 2 3
// 1 2 3
@@ -834,7 +831,6 @@ static int diff_write(buf_T *buf, diffin_T *din)
return r;
}
///
/// Update the diffs for all buffers involved.
///
/// @param dio
@@ -908,20 +904,16 @@ theend:
xfree(dio->dio_diff.dout_fname);
}
///
/// Return true if the options are set to use the internal diff library.
/// Note that if the internal diff failed for one of the buffers, the external
/// diff will be used anyway.
///
int diff_internal(void)
FUNC_ATTR_PURE
{
return (diff_flags & DIFF_INTERNAL) != 0 && *p_dex == NUL;
}
///
/// Return true if the internal diff failed for one of the diff buffers.
///
static int diff_internal_failed(void)
{
// Only need to do something when there is another buffer.
@@ -1002,11 +994,9 @@ theend:
}
}
///
/// Do a quick test if "diff" really works. Otherwise it looks like there
/// are no differences. Can't use the return value, it's non-zero when
/// there are differences.
///
static int check_external_diff(diffio_T *diffio)
{
// May try twice, first with "-a" and then without.
@@ -1090,9 +1080,7 @@ static int check_external_diff(diffio_T *diffio)
return OK;
}
///
/// Invoke the xdiff function.
///
static int diff_file_internal(diffio_T *diffio)
{
xpparam_t param;
@@ -1812,9 +1800,7 @@ void diff_clear(tabpage_T *tp)
tp->tp_first_diff = NULL;
}
///
/// return true if the options are set to use diff linematch
///
/// Return true if the options are set to use diff linematch.
bool diff_linematch(diff_T *dp)
{
if (!(diff_flags & DIFF_LINEMATCH)) {

View File

@@ -465,6 +465,7 @@ static void draw_sign(bool nrcol, win_T *wp, winlinevars_T *wlv, int sign_idx, i
int fill = nrcol ? number_width(wp) + 1 : SIGN_WIDTH;
draw_col_fill(wlv, schar_from_ascii(' '), fill, attr);
int sign_pos = wlv->off - SIGN_WIDTH - (int)nrcol;
assert(sign_pos >= 0);
linebuf_char[sign_pos] = sattr.text[0];
linebuf_char[sign_pos + 1] = sattr.text[1];
} else {
@@ -1551,7 +1552,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
// When only updating the columns and that's done, stop here.
if (col_rows > 0) {
wlv_put_linebuf(wp, &wlv, wlv.off, false, bg_attr, 0);
wlv_put_linebuf(wp, &wlv, MIN(wlv.off, grid->cols), false, bg_attr, 0);
// Need to update more screen lines if:
// - 'statuscolumn' needs to be drawn, or
// - LineNrAbove or LineNrBelow is used, or
@@ -1596,6 +1597,10 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
// hide virt_text on text hidden by 'nowrap' or 'smoothscroll'
decor_redraw_col(wp, (colnr_T)(ptr - line) - 1, wlv.off, true, &decor_state);
}
if (wlv.col >= grid->cols) {
wlv.col = wlv.off = grid->cols;
goto end_check;
}
}
if (cul_screenline && wlv.filler_todo <= 0
@@ -2650,13 +2655,6 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
conceal_cursor_used = conceal_cursor_line(curwin);
}
// When the window is too narrow draw all "@" lines.
if (leftcols_width >= wp->w_grid.cols && is_wrapped) {
win_draw_end(wp, schar_from_ascii('@'), true, wlv.row, wp->w_grid.rows, HLF_AT);
set_empty_rows(wp, wlv.row);
wlv.row = endrow;
}
break;
}
@@ -2844,10 +2842,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
}
}
end_check:
// At end of screen line and there is more to come: Display the line
// so far. If there is no more to display it is caught above.
if (wlv.col >= grid->cols && (!has_foldtext || virt_line_offset >= 0)
&& (*ptr != NUL
&& (wlv.col <= leftcols_width
|| *ptr != NUL
|| wlv.filler_todo > 0
|| (wp->w_p_list && wp->w_p_lcs_chars.eol != NUL && lcs_eol_todo)
|| (wlv.n_extra != 0 && (wlv.sc_extra != NUL || *wlv.p_extra != NUL))

View File

@@ -927,13 +927,7 @@ int showmode(void)
msg_ext_clear(true);
}
// Don't make non-flushed message part of the showmode and reset global
// variables before flushing to to avoid recursiveness.
bool draw_mode = redraw_mode;
bool clear_cmd = clear_cmdline;
redraw_cmdline = false;
redraw_mode = false;
clear_cmdline = false;
// Don't make non-flushed message part of the showmode.
msg_ext_ui_flush();
msg_grid_validate();
@@ -956,8 +950,8 @@ int showmode(void)
msg_check_for_delay(false);
// if the cmdline is more than one line high, erase top lines
bool need_clear = clear_cmd;
if (clear_cmd && cmdline_row < Rows - 1) {
bool need_clear = clear_cmdline;
if (clear_cmdline && cmdline_row < Rows - 1) {
msg_clr_cmdline(); // will reset clear_cmdline
}
@@ -1079,7 +1073,7 @@ int showmode(void)
}
mode_displayed = true;
if (need_clear || clear_cmd || draw_mode) {
if (need_clear || clear_cmdline || redraw_mode) {
msg_clr_eos();
}
msg_didout = false; // overwrite this message
@@ -1088,10 +1082,10 @@ int showmode(void)
msg_no_more = false;
lines_left = save_lines_left;
need_wait_return = nwr_save; // never ask for hit-return for this
} else if (clear_cmd && msg_silent == 0) {
} else if (clear_cmdline && msg_silent == 0) {
// Clear the whole command line. Will reset "clear_cmdline".
msg_clr_cmdline();
} else if (draw_mode) {
} else if (redraw_mode) {
msg_pos_mode();
msg_clr_eos();
}
@@ -1114,6 +1108,10 @@ int showmode(void)
grid_line_flush();
}
redraw_cmdline = false;
redraw_mode = false;
clear_cmdline = false;
return length;
}
@@ -1544,6 +1542,7 @@ static void win_update(win_T *wp)
// Force redraw when width of 'number' or 'relativenumber' column changes.
if (wp->w_nrwidth != nrwidth_new) {
type = UPD_NOT_VALID;
changed_line_abv_curs_win(wp);
wp->w_nrwidth = nrwidth_new;
} else {
// Set mod_top to the first line that needs displaying because of

View File

@@ -2025,7 +2025,6 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
// '0' and '^' are special, because they can be followed by CTRL-D.
#define ISSPECIAL(c) ((c) < ' ' || (c) >= DEL || (c) == '0' || (c) == '^')
///
/// "flags": INSCHAR_FORMAT - force formatting
/// INSCHAR_CTRLV - char typed just after CTRL-V
/// INSCHAR_NO_FEX - don't use 'formatexpr'
@@ -4419,18 +4418,30 @@ static bool ins_tab(void)
// Delete following spaces.
int i = cursor->col - fpos.col;
if (i > 0) {
STRMOVE(ptr, ptr + i);
if (!(State & VREPLACE_FLAG)) {
char *newp = xmalloc((size_t)(curbuf->b_ml.ml_line_len - i));
ptrdiff_t col = ptr - curbuf->b_ml.ml_line_ptr;
if (col > 0) {
memmove(newp, ptr - col, (size_t)col);
}
memmove(newp + col, ptr + i, (size_t)(curbuf->b_ml.ml_line_len - col - i));
if (curbuf->b_ml.ml_flags & (ML_LINE_DIRTY | ML_ALLOCATED)) {
xfree(curbuf->b_ml.ml_line_ptr);
}
curbuf->b_ml.ml_line_ptr = newp;
curbuf->b_ml.ml_line_len -= i;
curbuf->b_ml.ml_flags = (curbuf->b_ml.ml_flags | ML_LINE_DIRTY) & ~ML_EMPTY;
inserted_bytes(fpos.lnum, change_col,
cursor->col - change_col, fpos.col - change_col);
} else {
STRMOVE(ptr, ptr + i);
}
// correct replace stack.
if ((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG)) {
for (temp = i; --temp >= 0;) {
replace_join(repl_off);
}
}
if (!(State & VREPLACE_FLAG)) {
curbuf->b_ml.ml_line_len -= i;
inserted_bytes(fpos.lnum, change_col,
cursor->col - change_col, fpos.col - change_col);
}
}
cursor->col -= i;

View File

@@ -4403,8 +4403,8 @@ M.funcs = {
difference if the buffer is displayed in a window with
different 'virtualedit' or 'list' values.
Examples: >
:xnoremap <CR>
Examples: >vim
xnoremap <CR>
\ <Cmd>echom getregion(
\ getpos('v'), getpos('.'), #{ type: mode() })<CR>
<
@@ -5203,7 +5203,7 @@ M.funcs = {
Note that `v:_null_string`, `v:_null_list`, `v:_null_dict` and
`v:_null_blob` have the same `id()` with different types
because they are internally represented as NULL pointers.
`id()` returns a hexadecimal representanion of the pointers to
`id()` returns a hexadecimal representation of the pointers to
the containers (i.e. like `0x994a40`), same as `printf("%p",
{expr})`, but it is advised against counting on the exact
format of the return value.
@@ -6752,19 +6752,19 @@ M.funcs = {
Examples: >vim
" Assuming line 3 in buffer 5 contains "a"
:echo matchbufline(5, '\<\k\+\>', 3, 3)
[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]
echo matchbufline(5, '\<\k\+\>', 3, 3)
< `[{'lnum': 3, 'byteidx': 0, 'text': 'a'}]` >vim
" Assuming line 4 in buffer 10 contains "tik tok"
:echo matchbufline(10, '\<\k\+\>', 1, 4)
[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]
<
echo matchbufline(10, '\<\k\+\>', 1, 4)
< `[{'lnum': 4, 'byteidx': 0, 'text': 'tik'}, {'lnum': 4, 'byteidx': 4, 'text': 'tok'}]`
If {submatch} is present and is v:true, then submatches like
"\1", "\2", etc. are also returned. Example: >vim
" Assuming line 2 in buffer 2 contains "acd"
:echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
echo matchbufline(2, '\(a\)\?\(b\)\?\(c\)\?\(.*\)', 2, 2
\ {'submatches': v:true})
[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
<The "submatches" List always contains 9 items. If a submatch
< `[{'lnum': 2, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
The "submatches" List always contains 9 items. If a submatch
is not found, then an empty string is returned for that
submatch.
]=],
@@ -6984,17 +6984,17 @@ M.funcs = {
option settings on the pattern.
Example: >vim
:echo matchstrlist(['tik tok'], '\<\k\+\>')
[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]
:echo matchstrlist(['a', 'b'], '\<\k\+\>')
[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]
<
echo matchstrlist(['tik tok'], '\<\k\+\>')
< `[{'idx': 0, 'byteidx': 0, 'text': 'tik'}, {'idx': 0, 'byteidx': 4, 'text': 'tok'}]` >vim
echo matchstrlist(['a', 'b'], '\<\k\+\>')
< `[{'idx': 0, 'byteidx': 0, 'text': 'a'}, {'idx': 1, 'byteidx': 0, 'text': 'b'}]`
If "submatches" is present and is v:true, then submatches like
"\1", "\2", etc. are also returned. Example: >vim
:echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
echo matchstrlist(['acd'], '\(a\)\?\(b\)\?\(c\)\?\(.*\)',
\ #{submatches: v:true})
[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]
<The "submatches" List always contains 9 items. If a submatch
< `[{'idx': 0, 'byteidx': 0, 'text': 'acd', 'submatches': ['a', '', 'c', 'd', '', '', '', '', '']}]`
The "submatches" List always contains 9 items. If a submatch
is not found, then an empty string is returned for that
submatch.
]=],
@@ -8674,7 +8674,7 @@ M.funcs = {
the following mappings: >vim
nnoremap <expr> GG ":echom " .. screencol() .. "\n"
nnoremap <silent> GG :echom screencol()<CR>
noremap GG <Cmd>echom screencol()<Cr>
noremap GG <Cmd>echom screencol()<CR>
<
]=],
name = 'screencol',

View File

@@ -6479,7 +6479,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
char *v = os_resolve_shortcut(fname);
if (v == NULL) {
if (os_is_reparse_point_include(fname)) {
v = os_realpath(fname, v);
v = os_realpath(fname, NULL, MAXPATHL + 1);
}
}
rettv->vval.v_string = (v == NULL ? xstrdup(fname) : v);
@@ -6631,7 +6631,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
xfree(buf);
}
# else
char *v = os_realpath(fname, NULL);
char *v = os_realpath(fname, NULL, MAXPATHL + 1);
rettv->vval.v_string = v == NULL ? xstrdup(fname) : v;
# endif
#endif

View File

@@ -2531,6 +2531,10 @@ static bool cmdpreview_may_show(CommandLineState *s)
goto end;
}
// Flush now: external cmdline may itself wish to update the screen which is
// currently disallowed during cmdpreview(no longer needed in case that changes).
cmdline_ui_flush();
// Swap invalid command range if needed
if ((ea.argt & EX_RANGE) && ea.line1 > ea.line2) {
linenr_T lnum = ea.line1;
@@ -3449,11 +3453,9 @@ void cmdline_screen_cleared(void)
/// called by ui_flush, do what redraws necessary to keep cmdline updated.
void cmdline_ui_flush(void)
{
static bool flushing = false;
if (!ui_has(kUICmdline) || flushing) {
if (!ui_has(kUICmdline)) {
return;
}
flushing = true;
int level = ccline.level;
CmdlineInfo *line = &ccline;
while (level > 0 && line) {
@@ -3468,7 +3470,6 @@ void cmdline_ui_flush(void)
}
line = line->prev_ccline;
}
flushing = false;
}
// Put a character on the command line. Shifts the following text to the
@@ -4069,18 +4070,22 @@ static char *get_cmdline_completion(void)
return NULL;
}
set_expand_context(p->xpc);
if (p->xpc->xp_context == EXPAND_UNSUCCESSFUL) {
int xp_context = p->xpc->xp_context;
if (xp_context == EXPAND_NOTHING) {
set_expand_context(p->xpc);
xp_context = p->xpc->xp_context;
p->xpc->xp_context = EXPAND_NOTHING;
}
if (xp_context == EXPAND_UNSUCCESSFUL) {
return NULL;
}
char *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context);
char *cmd_compl = get_user_cmd_complete(NULL, xp_context);
if (cmd_compl == NULL) {
return NULL;
}
if (p->xpc->xp_context == EXPAND_USER_LIST
|| p->xpc->xp_context == EXPAND_USER_DEFINED) {
if (xp_context == EXPAND_USER_LIST || xp_context == EXPAND_USER_DEFINED) {
size_t buflen = strlen(cmd_compl) + strlen(p->xpc->xp_arg) + 2;
char *buffer = xmalloc(buflen);
snprintf(buffer, buflen, "%s,%s", cmd_compl, p->xpc->xp_arg);

View File

@@ -116,9 +116,10 @@ static void extmark_setraw(buf_T *buf, uint64_t mark, int row, colnr_T col, bool
{
MarkTreeIter itr[1] = { 0 };
MTKey key = marktree_lookup(buf->b_marktree, mark, itr);
if (key.pos.row < 0 || (key.pos.row == row && key.pos.col == col)) {
return;
}
bool move = key.pos.row >= 0 && (key.pos.row != row || key.pos.col != col);
// Already valid keys were being revalidated, presumably when encountering a
// SavePos from a modified mark. Avoid adding that to the decor again.
invalid = invalid && mt_invalid(key);
// Only the position before undo needs to be redrawn here,
// as the position after undo should be marked as changed.
@@ -130,19 +131,21 @@ static void extmark_setraw(buf_T *buf, uint64_t mark, int row, colnr_T col, bool
int row2 = 0;
if (invalid) {
mt_itr_rawkey(itr).flags &= (uint16_t) ~MT_FLAG_INVALID;
} else if (key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
} else if (move && key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
MTPos end = marktree_get_altpos(buf->b_marktree, key, NULL);
row1 = MIN(end.row, MIN(key.pos.row, row));
row2 = MAX(end.row, MAX(key.pos.row, row));
buf_signcols_count_range(buf, row1, row2, 0, kTrue);
}
marktree_move(buf->b_marktree, itr, row, col);
if (move) {
marktree_move(buf->b_marktree, itr, row, col);
}
if (invalid) {
MTPos end = marktree_get_altpos(buf->b_marktree, key, NULL);
buf_put_decor(buf, mt_decor(key), row, end.row);
} else if (key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
row2 = mt_paired(key) ? marktree_get_altpos(buf->b_marktree, key, NULL).row : row;
buf_put_decor(buf, mt_decor(key), row, row2);
} else if (move && key.flags & MT_FLAG_DECOR_SIGNTEXT && buf->b_signcols.autom) {
buf_signcols_count_range(buf, row1, row2, 0, kNone);
}
}

View File

@@ -349,23 +349,24 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
search_ctx->ffsc_stopdirs_v = xmalloc(sizeof(char *));
do {
char *helper;
void *ptr;
helper = walker;
ptr = xrealloc(search_ctx->ffsc_stopdirs_v,
(dircount + 1) * sizeof(char *));
char *helper = walker;
void *ptr = xrealloc(search_ctx->ffsc_stopdirs_v,
(dircount + 1) * sizeof(char *));
search_ctx->ffsc_stopdirs_v = ptr;
walker = vim_strchr(walker, ';');
if (walker) {
assert(walker - helper >= 0);
search_ctx->ffsc_stopdirs_v[dircount - 1] = xstrnsave(helper, (size_t)(walker - helper));
walker++;
assert(!walker || walker - helper >= 0);
size_t len = walker ? (size_t)(walker - helper) : strlen(helper);
// "" means ascent till top of directory tree.
if (*helper != NUL && !vim_isAbsName(helper) && len + 1 < MAXPATHL) {
// Make the stop dir an absolute path name.
xmemcpyz(ff_expand_buffer, helper, len);
search_ctx->ffsc_stopdirs_v[dircount - 1] = FullName_save(helper, len);
} else {
// this might be "", which means ascent till top of directory tree.
search_ctx->ffsc_stopdirs_v[dircount - 1] = xstrdup(helper);
search_ctx->ffsc_stopdirs_v[dircount - 1] = xmemdupz(helper, len);
}
if (walker) {
walker++;
}
dircount++;
} while (walker != NULL);
search_ctx->ffsc_stopdirs_v[dircount - 1] = NULL;
@@ -880,11 +881,12 @@ char *vim_findfile(void *search_ctx_arg)
if (search_ctx->ffsc_start_dir
&& search_ctx->ffsc_stopdirs_v != NULL && !got_int) {
ff_stack_T *sptr;
// path_end may point to the NUL or the previous path separator
ptrdiff_t plen = (path_end - search_ctx->ffsc_start_dir) + (*path_end != NUL);
// is the last starting directory in the stop list?
if (ff_path_in_stoplist(search_ctx->ffsc_start_dir,
(int)(path_end - search_ctx->ffsc_start_dir),
search_ctx->ffsc_stopdirs_v)) {
(size_t)plen, search_ctx->ffsc_stopdirs_v)) {
break;
}
@@ -1219,7 +1221,7 @@ static void ff_clear(ff_search_ctx_T *search_ctx)
/// check if the given path is in the stopdirs
///
/// @return true if yes else false
static bool ff_path_in_stoplist(char *path, int path_len, char **stopdirs_v)
static bool ff_path_in_stoplist(char *path, size_t path_len, char **stopdirs_v)
{
// eat up trailing path separators, except the first
while (path_len > 1 && vim_ispathsep(path[path_len - 1])) {
@@ -1232,20 +1234,16 @@ static bool ff_path_in_stoplist(char *path, int path_len, char **stopdirs_v)
}
for (int i = 0; stopdirs_v[i] != NULL; i++) {
if ((int)strlen(stopdirs_v[i]) > path_len) {
// match for parent directory. So '/home' also matches
// '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
// '/home/r' would also match '/home/rks'
if (path_fnamencmp(stopdirs_v[i], path, (size_t)path_len) == 0
&& vim_ispathsep(stopdirs_v[i][path_len])) {
return true;
}
} else {
if (path_fnamecmp(stopdirs_v[i], path) == 0) {
return true;
}
// match for parent directory. So '/home' also matches
// '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
// '/home/r' would also match '/home/rks'
if (path_fnamencmp(stopdirs_v[i], path, path_len) == 0
&& (strlen(stopdirs_v[i]) <= path_len
|| vim_ispathsep(stopdirs_v[i][path_len]))) {
return true;
}
}
return false;
}

View File

@@ -260,7 +260,11 @@ fixdict(1 + #version)
for _, item in ipairs(version) do
-- NB: all items are mandatory. But any error will be less confusing
-- with placeholder vim.NIL (than invalid mpack data)
put(item[1], item[2] or vim.NIL)
local val = item[2]
if val == nil then
val = vim.NIL
end
put(item[1], val)
end
put('build', version_build)

View File

@@ -128,8 +128,16 @@ for i = 1, #events do
write_signature(call_output, ev, '')
call_output:write('\n{\n')
if ev.remote_only then
-- Lua callbacks may emit other events or the same event again. Avoid the latter
-- by adding a recursion guard to each generated function that may call a Lua callback.
call_output:write(' static bool entered = false;\n')
call_output:write(' if (entered) {\n')
call_output:write(' return;\n')
call_output:write(' }\n')
call_output:write(' entered = true;\n')
write_arglist(call_output, ev)
call_output:write(' ui_call_event("' .. ev.name .. '", ' .. args .. ');\n')
call_output:write(' entered = false;\n')
elseif ev.compositor_impl then
call_output:write(' ui_comp_' .. ev.name)
write_signature(call_output, ev, '', true)

View File

@@ -2,7 +2,7 @@ return {
{"major", ${NVIM_VERSION_MAJOR}},
{"minor", ${NVIM_VERSION_MINOR}},
{"patch", ${NVIM_VERSION_PATCH}},
{"prerelease", "$NVIM_VERSION_PRERELEASE" ~= ""},
{"prerelease", "${NVIM_VERSION_PRERELEASE}" ~= ""},
{"api_level", ${NVIM_API_LEVEL}},
{"api_compatible", ${NVIM_API_LEVEL_COMPAT}},
{"api_prerelease", ${NVIM_API_PRERELEASE}},

View File

@@ -104,10 +104,10 @@ static buffheader_T readbuf1 = { { NULL, { NUL } }, NULL, 0, 0 };
static buffheader_T readbuf2 = { { NULL, { NUL } }, NULL, 0, 0 };
/// Buffer used to store typed characters for vim.on_key().
static kvec_withinit_t(char, MAXMAPLEN) on_key_buf = KVI_INITIAL_VALUE(on_key_buf);
static kvec_withinit_t(char, MAXMAPLEN + 1) on_key_buf = KVI_INITIAL_VALUE(on_key_buf);
/// Number of following bytes that should not be stored for vim.on_key().
static size_t no_on_key_len = 0;
static size_t on_key_ignore_len = 0;
static int typeahead_char = 0; ///< typeahead char that's not flushed
@@ -1009,18 +1009,18 @@ int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent)
/// Uses cmd_silent, KeyTyped and KeyNoremap to restore the flags belonging to
/// the char.
///
/// @param no_on_key don't store these bytes for vim.on_key()
/// @param on_key_ignore don't store these bytes for vim.on_key()
///
/// @return the length of what was inserted
int ins_char_typebuf(int c, int modifiers, bool no_on_key)
int ins_char_typebuf(int c, int modifiers, bool on_key_ignore)
{
char buf[MB_MAXBYTES * 3 + 4];
unsigned len = special_to_buf(c, modifiers, true, buf);
assert(len < sizeof(buf));
buf[len] = NUL;
ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
if (KeyTyped && no_on_key) {
no_on_key_len += len;
if (KeyTyped && on_key_ignore) {
on_key_ignore_len += len;
}
return (int)len;
}
@@ -1188,22 +1188,21 @@ static void gotchars(const uint8_t *chars, size_t len)
updatescript(state.buf[i]);
}
state.buf[state.buflen] = NUL;
if (state.buflen > on_key_ignore_len) {
kvi_concat_len(on_key_buf, (char *)state.buf + on_key_ignore_len,
state.buflen - on_key_ignore_len);
on_key_ignore_len = 0;
} else {
on_key_ignore_len -= state.buflen;
}
if (reg_recording != 0) {
state.buf[state.buflen] = NUL;
add_buff(&recordbuff, (char *)state.buf, (ptrdiff_t)state.buflen);
// remember how many chars were last recorded
last_recorded_len += state.buflen;
}
if (state.buflen > no_on_key_len) {
vim_unescape_ks((char *)state.buf + no_on_key_len);
kvi_concat(on_key_buf, (char *)state.buf + no_on_key_len);
no_on_key_len = 0;
} else {
no_on_key_len -= state.buflen;
}
state.buflen = 0;
}
@@ -1221,7 +1220,7 @@ static void gotchars(const uint8_t *chars, size_t len)
void gotchars_ignore(void)
{
uint8_t nop_buf[3] = { K_SPECIAL, KS_EXTRA, KE_IGNORE };
no_on_key_len += 3;
on_key_ignore_len += 3;
gotchars(nop_buf, 3);
}
@@ -1634,8 +1633,52 @@ int vgetc(void)
c = TO_SPECIAL(c2, c);
}
// a keypad or special function key was not mapped, use it like
// its ASCII equivalent
// For a multi-byte character get all the bytes and return the
// converted character.
// Note: This will loop until enough bytes are received!
int n;
if ((n = MB_BYTE2LEN_CHECK(c)) > 1) {
no_mapping++;
buf[0] = (uint8_t)c;
for (int i = 1; i < n; i++) {
buf[i] = (uint8_t)vgetorpeek(true);
if (buf[i] == K_SPECIAL) {
// Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
// which represents a K_SPECIAL (0x80).
vgetorpeek(true); // skip KS_SPECIAL
vgetorpeek(true); // skip KE_FILLER
}
}
no_mapping--;
c = utf_ptr2char((char *)buf);
}
// If mappings are enabled (i.e., not i_CTRL-V) and the user directly typed
// something with MOD_MASK_ALT (<M-/<A- modifier) that was not mapped, interpret
// <M-x> as <Esc>x rather than as an unbound <M-x> keypress. #8213
// In Terminal mode, however, this is not desirable. #16202 #16220
// Also do not do this for mouse keys, as terminals encode mouse events as
// CSI sequences, and MOD_MASK_ALT has a meaning even for unmapped mouse keys.
if (!no_mapping && KeyTyped && mod_mask == MOD_MASK_ALT
&& !(State & MODE_TERMINAL) && !is_mouse_key(c)) {
mod_mask = 0;
int len = ins_char_typebuf(c, 0, false);
ins_char_typebuf(ESC, 0, false);
int old_len = len + 3; // K_SPECIAL KS_MODIFIER MOD_MASK_ALT takes 3 more bytes
ungetchars(old_len);
if (on_key_buf.size >= (size_t)old_len) {
on_key_buf.size -= (size_t)old_len;
}
continue;
}
if (vgetc_char == 0) {
vgetc_mod_mask = mod_mask;
vgetc_char = c;
}
// A keypad or special function key was not mapped, use it like
// its ASCII equivalent.
switch (c) {
case K_KPLUS:
c = '+'; break;
@@ -1713,50 +1756,6 @@ int vgetc(void)
c = K_RIGHT; break;
}
// For a multi-byte character get all the bytes and return the
// converted character.
// Note: This will loop until enough bytes are received!
int n;
if ((n = MB_BYTE2LEN_CHECK(c)) > 1) {
no_mapping++;
buf[0] = (uint8_t)c;
for (int i = 1; i < n; i++) {
buf[i] = (uint8_t)vgetorpeek(true);
if (buf[i] == K_SPECIAL) {
// Must be a K_SPECIAL - KS_SPECIAL - KE_FILLER sequence,
// which represents a K_SPECIAL (0x80).
vgetorpeek(true); // skip KS_SPECIAL
vgetorpeek(true); // skip KE_FILLER
}
}
no_mapping--;
c = utf_ptr2char((char *)buf);
}
if (vgetc_char == 0) {
vgetc_mod_mask = mod_mask;
vgetc_char = c;
}
// If mappings are enabled (i.e., not i_CTRL-V) and the user directly typed something with
// MOD_MASK_ALT (<M-/<A- modifier) that was not mapped, interpret <M-x> as <Esc>x rather
// than as an unbound <M-x> keypress. #8213
// In Terminal mode, however, this is not desirable. #16202 #16220
// Also do not do this for mouse keys, as terminals encode mouse events as CSI sequences, and
// MOD_MASK_ALT has a meaning even for unmapped mouse keys.
if (!no_mapping && KeyTyped && mod_mask == MOD_MASK_ALT && !(State & MODE_TERMINAL)
&& !is_mouse_key(c)) {
mod_mask = 0;
int len = ins_char_typebuf(c, 0, false);
ins_char_typebuf(ESC, 0, false);
int old_len = len + 3; // K_SPECIAL KS_MODIFIER MOD_MASK_ALT takes 3 more bytes
ungetchars(old_len);
if (on_key_buf.size >= (size_t)old_len) {
on_key_buf.size -= (size_t)old_len;
}
continue;
}
break;
}
@@ -1769,7 +1768,8 @@ int vgetc(void)
may_garbage_collect = false;
// Execute Lua on_key callbacks.
nlua_execute_on_key(c, on_key_buf.items, on_key_buf.size);
kvi_push(on_key_buf, NUL);
nlua_execute_on_key(c, on_key_buf.items);
kvi_destroy(on_key_buf);
kvi_init(on_key_buf);

View File

@@ -106,7 +106,8 @@ EXTERN int Columns INIT( = DFLT_COLS); // nr of columns in the screen
// held down based on the MOD_MASK_* symbols that are read first.
EXTERN int mod_mask INIT( = 0); // current key modifiers
// The value of "mod_mask" and the unmodified character before calling merge_modifiers().
// The value of "mod_mask" and the unmodified character in vgetc() after it has
// called vgetorpeek() enough times.
EXTERN int vgetc_mod_mask INIT( = 0);
EXTERN int vgetc_char INIT( = 0);
@@ -146,8 +147,7 @@ EXTERN hlf_T edit_submode_highl; // highl. method for extra info
EXTERN bool cmdmsg_rl INIT( = false); // cmdline is drawn right to left
EXTERN int msg_col;
EXTERN int msg_row;
EXTERN int msg_scrolled; // Number of screen lines that windows have
// scrolled because of printing messages.
EXTERN int msg_scrolled; ///< Number of screen lines that messages have scrolled.
// when true don't set need_wait_return in msg_puts_attr()
// when msg_scrolled is non-zero
EXTERN bool msg_scrolled_ign INIT( = false);

View File

@@ -369,7 +369,7 @@ static const char *highlight_init_light[] = {
"SpellLocal guisp=NvimDarkGreen gui=undercurl cterm=undercurl",
"SpellRare guisp=NvimDarkCyan gui=undercurl cterm=undercurl",
"StatusLine guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=reverse",
"StatusLineNC guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=bold",
"StatusLineNC guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=bold,underline",
"Title guifg=NvimDarkGrey2 gui=bold cterm=bold",
"Visual guibg=NvimLightGrey4 ctermfg=15 ctermbg=0",
"WarningMsg guifg=NvimDarkYellow ctermfg=3",
@@ -454,7 +454,7 @@ static const char *highlight_init_dark[] = {
"SpellLocal guisp=NvimLightGreen gui=undercurl cterm=undercurl",
"SpellRare guisp=NvimLightCyan gui=undercurl cterm=undercurl",
"StatusLine guifg=NvimDarkGrey3 guibg=NvimLightGrey3 cterm=reverse",
"StatusLineNC guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=bold",
"StatusLineNC guifg=NvimLightGrey3 guibg=NvimDarkGrey3 cterm=bold,underline",
"Title guifg=NvimLightGrey2 gui=bold cterm=bold",
"Visual guibg=NvimDarkGrey4 ctermfg=0 ctermbg=15",
"WarningMsg guifg=NvimLightYellow ctermfg=11",
@@ -2268,7 +2268,6 @@ void highlight_changed(void)
// sentinel value. used when no highlight namespace is active
highlight_attr[HLF_COUNT] = 0;
//
// Setup the user highlights
//
// Temporarily utilize 10 more hl entries:

View File

@@ -3419,9 +3419,7 @@ term_again:
break;
}
//
// Skip preprocessor directives and blank lines.
//
if (cin_ispreproc_cont(&l, &curwin->w_cursor.lnum, &amount)) {
continue;
}

View File

@@ -121,7 +121,7 @@ static char *ctrl_x_msgs[] = {
N_(" Command-line completion (^V^N^P)"),
N_(" User defined completion (^U^N^P)"),
N_(" Omni completion (^O^N^P)"),
N_(" Spelling suggestion (s^N^P)"),
N_(" Spelling suggestion (^S^N^P)"),
N_(" Keyword Local completion (^N^P)"),
NULL, // CTRL_X_EVAL doesn't use msg.
N_(" Command-line completion (^V^N^P)"),

View File

@@ -2053,10 +2053,11 @@ char *nlua_register_table_as_callable(const typval_T *const arg)
return name;
}
void nlua_execute_on_key(int c, char *typed_buf, size_t typed_len)
void nlua_execute_on_key(int c, char *typed_buf)
{
char buf[MB_MAXBYTES * 3 + 4];
size_t buf_len = special_to_buf(c, mod_mask, false, buf);
vim_unescape_ks(typed_buf);
lua_State *const lstate = global_lstate;
@@ -2075,7 +2076,7 @@ void nlua_execute_on_key(int c, char *typed_buf, size_t typed_len)
lua_pushlstring(lstate, buf, buf_len);
// [ vim, vim._on_key, buf, typed_buf ]
lua_pushlstring(lstate, typed_buf, typed_len);
lua_pushstring(lstate, typed_buf);
int save_got_int = got_int;
got_int = false; // avoid interrupts when the key typed is Ctrl-C

View File

@@ -545,10 +545,8 @@ int main(int argc, char **argv)
no_wait_return = true;
//
// Create the requested number of windows and edit buffers in them.
// Also does recovery if "recoverymode" set.
//
create_windows(&params);
TIME_MSG("opening buffers");

View File

@@ -78,13 +78,15 @@ int xctz(uint64_t x)
}
/// Count number of set bits in bit field.
int popcount(uint64_t x)
unsigned xpopcount(uint64_t x)
{
// Use compiler builtin if possible.
#if defined(__clang__) || defined(__GNUC__)
return __builtin_popcountll(x);
#if defined(__NetBSD__)
return popcount64(x);
#elif defined(__clang__) || defined(__GNUC__)
return (unsigned)__builtin_popcountll(x);
#else
int count = 0;
unsigned count = 0;
for (; x != 0; x >>= 1) {
if (x & 1) {
count++;

View File

@@ -688,6 +688,9 @@ popupexit:
if (in_statuscol && wp->w_p_rl) {
click_col = wp->w_width_inner - click_col - 1;
}
if (in_statuscol && click_col >= (int)wp->w_statuscol_click_defs_size) {
return false;
}
if (click_defs != NULL) {
switch (click_defs[click_col].type) {

View File

@@ -1579,8 +1579,20 @@ void adjust_skipcol(void)
redraw_later(curwin, UPD_NOT_VALID);
return; // don't scroll in the other direction now
}
colnr_T col = curwin->w_virtcol - curwin->w_skipcol + scrolloff_cols;
int row = 0;
colnr_T col = curwin->w_virtcol + scrolloff_cols;
// Avoid adjusting for 'scrolloff' beyond the text line height.
if (scrolloff_cols > 0) {
int size = win_linetabsize(curwin, curwin->w_topline,
ml_get(curwin->w_topline), (colnr_T)MAXCOL);
size = width1 + width2 * ((size - width1 + width2 - 1) / width2);
while (col > size) {
col -= width2;
}
}
col -= curwin->w_skipcol;
if (col >= width1) {
col -= width1;
row++;
@@ -2114,7 +2126,10 @@ void scroll_cursor_bot(win_T *wp, int min_scroll, bool set_topbot)
wp->w_valid |= VALID_TOPLINE;
wp->w_viewport_invalid = true;
cursor_correct_sms(wp);
// Make sure cursor is still visible after adjusting skipcol for "zb".
if (set_topbot) {
cursor_correct_sms(wp);
}
}
/// Recompute topline to put the cursor halfway across the window
@@ -2473,7 +2488,7 @@ int pagescroll(Direction dir, int count, bool half)
int curscount = count;
// Adjust count so as to not reveal end of buffer lines.
if (dir == FORWARD
&& (curwin->w_topline + curwin->w_height + count > buflen || hasAnyFolding(curwin))) {
&& (curwin->w_topline + curwin->w_height_inner + count > buflen || hasAnyFolding(curwin))) {
int n = plines_correct_topline(curwin, curwin->w_topline, NULL, false, NULL);
if (n - count < curwin->w_height_inner && curwin->w_topline < buflen) {
n += plines_m_win(curwin, curwin->w_topline + 1, buflen, curwin->w_height_inner + count);
@@ -2505,9 +2520,11 @@ int pagescroll(Direction dir, int count, bool half)
? MAX(1, (int)p_window - 2) : get_scroll_overlap(dir));
nochange = scroll_with_sms(dir, count, &count);
// Place cursor at top or bottom of window.
validate_botline(curwin);
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1);
if (!nochange) {
// Place cursor at top or bottom of window.
validate_botline(curwin);
curwin->w_cursor.lnum = (dir == FORWARD ? curwin->w_topline : curwin->w_botline - 1);
}
}
if (get_scrolloff_value(curwin) > 0) {

View File

@@ -1659,7 +1659,6 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char **text
// When starting on a ']' count it, so that we include the '['.
bn = ptr[col] == ']';
//
// 2. Back up to start of identifier/text.
//
// Remember class of character under cursor.

View File

@@ -747,7 +747,7 @@ return {
applying 'breakindent', even if the resulting
text should normally be narrower. This prevents
text indented almost to the right window border
occupying lot of vertical space when broken.
occupying lots of vertical space when broken.
(default: 20)
shift:{n} After applying 'breakindent', the wrapped line's
beginning will be shifted by the given number of
@@ -4221,7 +4221,7 @@ return {
in Insert mode as specified with the 'indentkeys' option.
When this option is not empty, it overrules the 'cindent' and
'smartindent' indenting. When 'lisp' is set, this option is
is only used when 'lispoptions' contains "expr:1".
only used when 'lispoptions' contains "expr:1".
The expression is evaluated with |v:lnum| set to the line number for
which the indent is to be computed. The cursor is also in this line
when the expression is evaluated (but it may be moved around).
@@ -4612,7 +4612,7 @@ return {
part can be in one of two forms:
1. A list of pairs. Each pair is a "from" character immediately
followed by the "to" character. Examples: "aA", "aAbBcC".
2. A list of "from" characters, a semi-colon and a list of "to"
2. A list of "from" characters, a semicolon and a list of "to"
characters. Example: "abc;ABC"
Example: "aA,fgh;FGH,cCdDeE"
Special characters need to be preceded with a backslash. These are
@@ -4725,7 +4725,7 @@ return {
update use |:redraw|.
This may occasionally cause display errors. It is only meant to be set
temporarily when performing an operation where redrawing may cause
flickering or cause a slow down.
flickering or cause a slowdown.
]=],
full_name = 'lazyredraw',
scope = { 'global' },
@@ -4868,6 +4868,9 @@ return {
between tabs and spaces and for trailing blanks. Further changed by
the 'listchars' option.
When 'listchars' does not contain "tab" field, tabs are shown as "^I"
or "<09>", like how unprintable characters are displayed.
The cursor is displayed at the start of the space a Tab character
occupies, not at the end as usual in Normal mode. To get this cursor
position while displaying Tabs with spaces, use: >vim
@@ -5984,7 +5987,7 @@ return {
set path+=
< To use an environment variable, you probably need to replace the
separator. Here is an example to append $INCL, in which directory
names are separated with a semi-colon: >vim
names are separated with a semicolon: >vim
let &path = &path .. "," .. substitute($INCL, ';', ',', 'g')
< Replace the ';' with a ':' or whatever separator is used. Note that
this doesn't work when $INCL contains a comma or white space.
@@ -7300,7 +7303,7 @@ return {
defaults = { if_true = 'ltToOCF' },
desc = [=[
This option helps to avoid all the |hit-enter| prompts caused by file
messages, for example with CTRL-G, and to avoid some other messages.
messages, for example with CTRL-G, and to avoid some other messages.
It is a list of flags:
flag meaning when present ~
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
@@ -7889,7 +7892,7 @@ return {
minus two.
timeout:{millisec} Limit the time searching for suggestions to
{millisec} milli seconds. Applies to the following
{millisec} milliseconds. Applies to the following
methods. When omitted the limit is 5000. When
negative there is no limit.
@@ -9837,7 +9840,6 @@ return {
]=],
full_name = 'winfixbuf',
pv_name = 'p_wfb',
redraw = { 'current_window' },
scope = { 'window' },
short_desc = N_('pin a window to a specific buffer'),
type = 'boolean',

View File

@@ -474,17 +474,9 @@ void init_homedir(void)
var = os_homedir();
}
if (var != NULL) {
// Change to the directory and get the actual path. This resolves
// links. Don't do it when we can't return.
if (os_dirname(os_buf, MAXPATHL) == OK && os_chdir(os_buf) == 0) {
if (!os_chdir(var) && os_dirname(IObuff, IOSIZE) == OK) {
var = IObuff;
}
if (os_chdir(os_buf) != 0) {
emsg(_(e_prev_dir));
}
}
// Get the actual path. This resolves links.
if (var != NULL && os_realpath(var, IObuff, IOSIZE) != NULL) {
var = IObuff;
}
// Fall back to current working directory if home is not found

View File

@@ -1320,22 +1320,22 @@ bool os_fileid_equal_fileinfo(const FileID *file_id, const FileInfo *file_info)
/// Return the canonicalized absolute pathname.
///
/// @param[in] name Filename to be canonicalized.
/// @param[out] buf Buffer to store the canonicalized values. A minimum length
// of MAXPATHL+1 is required. If it is NULL, memory is
// allocated. In that case, the caller should deallocate this
// buffer.
/// @param[out] buf Buffer to store the canonicalized values.
/// If it is NULL, memory is allocated. In that case, the caller
/// should deallocate this buffer.
/// @param[in] len The length of the buffer.
///
/// @return pointer to the buf on success, or NULL.
char *os_realpath(const char *name, char *buf)
char *os_realpath(const char *name, char *buf, size_t len)
FUNC_ATTR_NONNULL_ARG(1)
{
uv_fs_t request;
int result = uv_fs_realpath(NULL, &request, name, NULL);
if (result == kLibuvSuccess) {
if (buf == NULL) {
buf = xmallocz(MAXPATHL);
buf = xmalloc(len);
}
xstrlcpy(buf, request.ptr, MAXPATHL + 1);
xstrlcpy(buf, request.ptr, len);
}
uv_fs_req_cleanup(&request);
return result == kLibuvSuccess ? buf : NULL;

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