Commit Graph

6451 Commits

Author SHA1 Message Date
dundargoc
b3e5587b7f
docs: various fixes (#26929)
Co-authored-by: Patrick Bollinger <owner@pjbollinger.com>
Co-authored-by: vilo1839 <139687192+vilo1839@users.noreply.github.com>
2024-01-17 14:01:39 +08:00
Sean Dewar
aa5819f5a5
vim-patch:211211052d04 (#27048)
runtime(odin): include ftplugin, syntax and indent script (vim/vim#13867)

211211052d

Translate the files from Vim9 script to legacy Vim script. Notably:

- Prefer case-matching comparisons where needed.
- Save and restore `&cpo`.
- Make the functions script-local. (Pretty easy to use these in expr options now
  since Vim 9.0 anyways)

Add a note after the header for each file stating that they're manually
translated.

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-01-16 23:08:41 +00:00
Jongwook Choi
3973a5e405 refactor(lsp): deprecate vim.lsp.util.lookup_section
This function is used only in the `workspace/configuration` handler,
and does not warrant a public API because of its confusing return types.

The only caller `vim.lsp.handlers["workspace.configuration"]` is also
refactored to use `vim.tbl_get()` instead.
2024-01-16 20:14:17 +00:00
Sean Dewar
91dc04a5e1
vim-patch:9.1.0013: Modula2 filetype support lacking (#27020)
Problem:  Modula2 filetype support lacking
Solution: Improve the Modula-2 runtime support, add additional modula2
          dialects, add compiler plugin, update syntax highlighting,
          include syntax tests, update Makefiles (Doug Kearns)

closes: vim/vim#6796
closes: vim/vim#8115

68a8947069

- Luaify the detection script:

  - Split the `(*!m2foo*)` and `(*!m2foo+bar*)` detection into two Lua patterns,
    as Lua capture groups cannot be used with `?` and friends (as they only work
    on character classes).

  - Use `vim.api.nvim_buf_call()` (ew) to call `modula2#SetDialect()` to ensure
    `b:modula2` is set for the given bufnr.

- Skip the syntax screendump tests. (A shame as they test some of the detection
  from `(*!m2foo+bar*)` tags, but I tested this locally and it seems to work)

- Port the synmenu.vim changes from Vim9 script. (Also tested this locally)

- (And also add the missing comma for `b:browsefilter` from earlier.)

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-16 17:45:57 +00:00
Luuk van Baal
463cb28a22 docs(column): 'statuscolumn' redraw interaction with 'relativenumber' 2024-01-16 12:14:00 +01:00
Lewis Russell
50284d07b6 fix(diagnostic): typing 2024-01-16 09:33:10 +00:00
Christian Clason
3fef24aa01 vim-patch:ef79c5783782
runtime(fortran): update fortran syntax (vim/vim#13870)

Support most remaining features of Fortran 2018/2023
Small improvements to folding etc,
Code cleanup: use \? instead of mix of \= and \?

ef79c57837

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2024-01-16 09:18:02 +01:00
zeertzjq
92672a161c
docs(builtin): remove signatures of undocumented functions (#27039)
Having an empty signature causes an empty line in generated docs,  so
remove it.

Also change ">" to ">vim" in foreach() docs.
2024-01-16 12:07:35 +08:00
zeertzjq
46a7c1b319
vim-patch:partial:9.1.0027: Vim is missing a foreach() func (#27037)
Problem:  Vim is missing a foreach() func
Solution: Implement foreach({expr1}, {expr2}) function,
          which applies {expr2} for each item in {expr1}
          without changing it (Ernie Rael)

closes: vim/vim#12166

e79e207760

Partial port as this doesn't handle non-materialized range() lists.

vim-patch:c92b8bed1fa6

runtime(help): delete duplicate help tag E741 (vim/vim#13861)

c92b8bed1f

Co-authored-by: Ernie Rael <errael@raelity.com>
2024-01-16 11:30:35 +08:00
zeertzjq
73e1942abe
vim-patch:9.1.0009: Cannot easily get the list of matches (#27028)
Problem:  Cannot easily get the list of matches
Solution: Add the matchstrlist() and matchbufline() Vim script
          functions (Yegappan Lakshmanan)

closes: vim/vim#13766

Omit CHECK_LIST_MATERIALIZE(): it populates a List with numbers only,
and there is a check for strings below.

f93b1c881a

vim-patch:eb3475df0d92

runtime(doc): Replace non-breaking space with normal space (vim/vim#13868)

eb3475df0d

Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
2024-01-16 08:00:08 +08:00
Daniel Steinberg
7589336120
feat(terminal): respond to OSC background and foreground request (#17197)
The motivation for this update is Issue #15365, where background=light
is not properly set for Nvim running from an Nvim :terminal. This can be
encountered when e.g., opening a terminal to make git commits, which
opens EDITOR=nvim in the nested terminal.

Under the implementation of this commit, the OSC response always
indicates a black or white foreground/background. While this may not
reflect the actual foreground/background color, it permits 'background'
to be retained for a nested Nvim instance running in the terminal
emulator. The behaviour matches Vim.
2024-01-15 10:12:07 -06:00
Christian Clason
7ed6966023 vim-patch:93197fde0f1d
runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"

Problem:  The "*.*" browsefilter pattern only matches all files on
	  Windows (Daryl Lee)
Solution: Use "*" to filter on all platforms but keep "*.*" as the label
	  text on Windows. (Fixes vim/vim#12685, Doug Kearns)

The *.* browsefilter pattern used to match "All Files" on Windows is a
legacy of the DOS 8.3 filename wildcard matching algorithm.  For reasons
of backward compatibility this still works on Windows to match all
files, even those without an extension.

However, this pattern only matches filenames containing a dot on other
platforms.  This often makes files without an extension difficult to
access from the file dialog, e.g., "Makefile"

On Windows it is still standard practice to use "*.*" for the filter
label so ftplugins should use "All Files (*.*)" on Windows and "All
Files (*)" on other platforms.  This matches Vim's default browsefilter
values.

This commit also normalises the browsefilter conditional test to check
for the Win32 and GTK GUI features and an unset b:browsefilter.

closes: vim/vim#12759

93197fde0f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-15 11:40:44 +01:00
Jongwook Choi
fa836cb98b docs(vvars): fix wrong lua types in vim.v variables
- cmdarg: string[] -> string
- shell_error: string -> int
- stderr: string -> int

- Add types for: cmdbang, errors, exception, false, true
2024-01-15 09:39:27 +00:00
Jongwook Choi
4d91604c88 docs: add lua typing for vim.NIL 2024-01-15 08:45:30 +00:00
altermo
e5ff71fbbf docs(builtin): overload functions with union return types 2024-01-14 14:06:35 +00:00
Jongwook Choi
2cdea852e8 docs: auto-generate docs for vim.lpeg and vim.re
- Add section `VIM.LPEG` and `VIM.RE` to docs/lua.txt.

- Add `_meta/re.lua` which adds luadoc and type annotations, for the
  vendored `vim.re` package.

- Fix minor style issues on `_meta/lpeg.lua` luadoc for better vimdocs
  generation.

- Fix a bug on `gen_vimdoc` where non-helptags in verbatim code blocks
  were parsed as helptags, affecting code examples on `vim.lpeg.Cf`,
  etc.

- Also move the `vim.regex` section below so that it can be located
  closer to `vim.lpeg` and `vim.re`.
2024-01-14 11:08:33 +00:00
Jongwook Choi
ce4ea638c7 fix(lsp): fix incorrect typing and doc for vim.lsp.rpc
Typings introduced in #26032 and #26552 have a few conflicts, so we
merge and clean them up. We also fix some incorrect type annotation in
the `vim.lsp.rpc` package. See the associated PR for more details.

Summary:

- vim.rpc.Dispatchers -> vim.lsp.rpc.Dispatchers
- vim.lsp.rpc.Error -> lsp.ResponseError
- Revise docs
2024-01-14 09:02:45 +01:00
zeertzjq
2bdd8fad4c
docs(builtin): fix mapset() signature (#27008) 2024-01-14 08:44:16 +08:00
Evgeni Chasnovski
0c850add3e
fix(colorscheme): default statusline groups usability #26921
Problem: Current values of `StatusLine` and `StatusLineNC` are currently
  designed to be visually distinctive while being not intrusive.
  However, the compromise was more shifted towards "not intrusive".
  After the feedback, statusline highlight groups should be designed to:
  - Make current window clearly noticeable. Meaning `StatusLine` and
    `StatusLineNC` should obviously differ.
  - Make non-current windows clearly separable. Meaning `StatusLineNC`
    and `Normal`/`NormalNC` should obviously differ.

Solution:
  - Update `StatusLineNC` to have more visible background.
  - Update `StatusLine` to be inverted variant of `StatusLineNC`.
  - Update `WinBar` and `WinBarNC` to not link to `StatusLine` and
    `StatusLineNC` because it makes two goals harder to achieve.
  - Update `TabLine` to link to `StatusLineNC` instead of `StatusLine`
    to not be very visually intrusive.
2024-01-13 16:35:37 -08:00
zeertzjq
2783b6b0a4 vim-patch:9.1.0015: i_CTRL-R- no longer works in replace mode
Problem:  i_CTRL-R- no longer works in replace mode
Solution: delete characters in replace mode before putting, add a test,
          add a bit warning into the documentation, that i_CTRL-R-P/O
          is not supported in Replace mode for now

fixes: vim/vim#13792
closes: vim/vim#13816

5d5cbb2b9a

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-13 08:29:47 +08:00
dundargoc
c8f696f2b0 vim-patch:9.1.0025: A few typos in tests and justify.vim
Problem:  A few typos in tests and justify.vim
Solution: fix them

closes: vim/vim#13848

dc4c37b9d5

Co-authored-by: dundargoc <gocdundar@gmail.com>
2024-01-12 22:24:52 +01:00
Christian Clason
7f249936a9 vim-patch:2357765304e4
runtime(netrw): Decode multibyte percent-encoding filename correctly (vim/vim#13842)

Use `printf("%c")` instead of `nr2char()` to handle '%xx' as a byte.

Close vim/vim#13787

2357765304

Co-authored-by: K.Takata <kentkt@csc.jp>
2024-01-12 19:45:15 +01:00
Christian Clason
061a0d5a48 vim-patch:5f4cc8ea65e8
runtime(colorschemes): Add initial support for Added/Removed/Changed highlight groups (vim/vim#13830)

For some of the colorschemes where diffAdded and diffRemoved were explicitly set up.

5f4cc8ea65

Co-authored-by: Maxim Kim <habamax@gmail.com>
2024-01-12 13:52:26 +01:00
Christian Clason
f46ae13685 vim-patch:9.1.0016: default diff highlighting is too noisy
Problem:  default diff highlighting is too noisy
Solution: Link diff highlighting groups to new
          Added/Removed/Changed, revert previous change
          (Romain Lafourcade)

Remove diff* links added in vim/vim#13776 and doc added in commit b1392be

The links added in vim/vim#13776 are way too noisy for the contexts in which
the `diff` syntax is applied (git commits, patches, etc.).

This commit:

- removes those links
- adds new default highlighting groups Added, Changed and
  Removed
- links the diff highlighting groups to those new defaults
- removes the doc changes
- adjusts the syntax_completion test for those newly added group
  names

Note: Changes to the default color schemes will be handled separately,
by adding links to those newly created Added/Removed/Changed
highlighting groups.

related: vim/vim#13776
closes vim/vim#13825

124371c5a1

Co-authored-by: Romain Lafourcade <romain.lafourcade@razorfish.fr>
2024-01-12 13:52:26 +01:00
Lewis Russell
2f9ee9b6cf fix(doc): improve doc generation of types using lpeg
Added a lpeg grammar for LuaCATS and use it in lua2dox.lua
2024-01-11 16:24:12 +00:00
JD
a767c046f4
feat(vim.iter): add Iter:flatten (#26786)
Co-authored-by: Gregory Anders <greg@gpanders.com>
Co-authored-by: Jongwook Choi <wookayin@gmail.com>
2024-01-10 20:57:51 -06:00
Barrett Ruth
63a17322dd
fix(health): improve python executable check error handling (#26954)
Credit to @wookayin for the fix.
2024-01-10 07:05:44 +08:00
Barrett Ruth
c67efe3a9c
fix(health): correctly expand and resolve PYENV_ROOT (#26953) 2024-01-10 06:28:18 +08:00
Christian Clason
595f684c5b vim-patch:71d0ba07a33a
runtime(netrw): Sync with netrw 174b (vim/vim#13836)

* Import netrw v174b
* Revert unwanted changes
* Fix indent
* Revert some changes
* Update tags
* Break long line

71d0ba07a3

Co-authored-by: K.Takata <kentkt@csc.jp>
2024-01-09 23:22:48 +01:00
dundargoc
501cf32357
vim-patch:3a5b3df7764d (#26956)
runtime(tar): fix a few problems with the tar plugin

From: vim/vim#138331:
  - Updating .tar.zst files was broken. Fixes vim/vim#12639.
  - Extracting files from .tar.zst / .tzs files was also broken and
    works now.
From: vim/vim#12637:
  - Fixes variable assignment and typo
From: vim/vim#8109:
  - Rename .tzs to the more standard .tzst

fixes: vim/vim#12639
fixes: vim/vim#8105
closes: vim/vim#8109
closes: vim/vim#12637
closes: vim/vim#13831

3a5b3df776

Co-authored-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Martin Rys <martin@rys.pw>
Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Co-authored-by: Carlo Teubner <carlo@cteubner.net>
2024-01-10 06:03:09 +08:00
Ghjuvan Lacambre
beca827212
feat(terminal): trigger TermRequest autocommand events (#22159)
This commit implements a new TermRequest autocommand event and has Neovim
emit this event when children of terminal buffers emit an OSC or DCS sequence
libvterm does not handle.

The TermRequest autocommand event has additional data in the
v:termrequest variable.

Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-01-09 08:27:56 -06:00
Jongwook Choi
f40df63bdc fix(docs): make lines not overflow in vim docs
Problem: Some lines in the generated vim doc are overflowing, not
correctly wrapped at 78 characters. This happens when docs body contains
several consecutive 'inline' elements generated by doxygen.

Solution: Take into account the current column offset of the last line,
and prepend some padding before doc_wrap().
2024-01-09 13:33:18 +00:00
Jongwook Choi
fbe40caa7c docs(treesitter): improve 'no parser' error message for InspectTree
Improve error messages for `:InspectTree`, when no parsers are available
for the current buffer and filetype. We can show more informative and
helpful error message for users (e.g., which lang was searched for):

```
 ... No parser available for the given buffer:
+... no parser for 'custom_ft' language, see :help treesitter-parsers
```

Also improve the relevant docs for *treesitter-parsers*.
2024-01-08 09:27:03 +00:00
Gregory Anders
8df3742378
fix(defaults): use augroup for default autocommands (#26933) 2024-01-06 18:08:29 -06:00
Christian Clason
099bd35a7d docs(luvref): update to version bump 2024-01-06 12:02:27 +01:00
zeertzjq
f38f86b1ad vim-patch:9.1.0007: can select empty inner text blocks
Problem:  can select empty inner text blocks
          (laurentalacoque)
Solution: make selecting empty inner text blocks an error

textobjects: Make selecting inner empty blocks an error

fixes: vim/vim#13514
closes: vim/vim#13523

ad4d7f446d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-06 06:24:02 +08:00
zeertzjq
dab5844082
vim-patch:9.1.0010: Keymap completion is not available (#26888)
Problem:  Keymap completion is not available
Solution: Add keymap completion (Doug Kearns)

Add keymap completion to the 'keymap' option, user commands and builtin
completion functions.

closes: vim/vim#13692

81642d9d6f

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2024-01-05 08:23:51 +08:00
Tristan Partin
88eb0ad149
fix(health): fix tmux RGB capability detection (#26886)
tmux indicates its RGB support via setrgbb and setrgbf. In modern tmux
code, Tc and RGB just set setrgbb and setrgbf, so we can just check for
them.

Link: 7eb496c00c
2024-01-04 15:51:52 -06:00
Lewis Russell
6635ec113f
Merge pull request #26791 from wookayin/gendoc
refactor(gen_vimdoc): general refactoring on vimdoc generation
2024-01-04 12:03:12 +00:00
Luuk van Baal
fa61e0c047 refactor(column): define and use maximum 'statuscolumn' width
Problem:  The maximum 'statuscolumn' width and grow behavior is undocumented.
Solution: Define, use and document the maximum 'statuscolumn' width and grow behavior.
2024-01-04 11:52:37 +00:00
Jaehwang Jung
dc48a98f9a fix(decorations): validate botline for on_win
Problem:
Many decoration providers (treesitter injection highlighting, semantic
token highlighting, inlay hint) rely on the correctness of the `botline`
argument of `on_win` callback. However, `botline` can be smaller than
the actual line number of the last displayed line if some lines are
folded. In such cases, some decorations will be missing in the lines not
covered by `botline`.

Solution:
Validate `botline` when invoking `on_win`.

NOTE:
It seems that the old code was deliberately avoiding this presumably due
to performance reasons. However, I haven't experienced noticeable lag
after this change, and I believe the cost of botline computation would
be much smaller than the cost of decoration providers.
2024-01-04 11:37:00 +00:00
Christian Clason
9b90657376 vim-patch:d94ca966ca6d
runtime(fortran): syntax and documentation updates (vim/vim#13811)

closes: vim/vim#13802

d94ca966ca

Co-authored-by: Ajit-Thakkar <142174202+Ajit-Thakkar@users.noreply.github.com>
2024-01-04 12:13:49 +01:00
Christian Clason
166b4284c8 vim-patch:b1392bee701d
runtime(doc): document that the diff filetype uses Diff hl groups

related: vim/vim#13776

b1392bee70

Co-authored-by: Christian Brabandt <cb@256bit.org>
2024-01-04 12:13:49 +01:00
Christian Clason
39ea076f2f vim-patch:80beeef0c6a4
runtime(vim): Add support for <ScriptCmd> syntax (vim/vim#10686)

Adding `<ScriptCmd>` to list of angle-bracket notation syntax, just like `<Cmd>`

`<Cmd>` is already highlighted.
```vim
nnoremap <leader>o <Cmd>Oldfiles()<CR>
```

`<ScriptCmd>` is not.

80beeef0c6

Co-authored-by: dezza <402927+dezza@users.noreply.github.com>
2024-01-04 12:13:49 +01:00
Christian Clason
8a6317e70a vim-patch:d4634a26cdcd
runtime(vim): Add support for `syntax foldlevel` command (vim/vim#6182)

d4634a26cd

Co-authored-by: Brad King <brad.king@kitware.com>
2024-01-04 12:13:49 +01:00
zeertzjq
5dbf6ab9b1
vim-patch:9.1.0004: reloading colorscheme when not changing 'background' (#26877)
Problem:  reloading colorscheme when not changing 'background'
Solution: Check, if the background option value actually changed,
          if not, return early.

Only reload colorscheme when bg is changed

Currently the highlight groups are re-initialized and the colorscheme
(if any) is reloaded anytime 'background' is set, even if it is not
changed. This is unnecessary, because if the value was not changed then
there is no need to change highlight groups or do anything with the
colorscheme. Instead, only reload the colorscheme if the value of
'background' was actually changed.

closes: vim/vim#13700

83ad2726ff

Co-authored-by: Gregory Anders <greg@gpanders.com>
2024-01-04 05:45:26 +08:00
Lewis Russell
3734519e3b feat(lua): add noref to deepcopy
Problem:

Currently `deepcopy` hashes every single tables it copies so it can be
reused. For tables of mostly unique items that are non recursive, this
hashing is unnecessarily expensive

Solution:

Port the `noref` argument from Vimscripts `deepcopy()`.

The below benchmark demonstrates the results for two extreme cases of
tables of different sizes. One table that uses the same table lots of
times and one with all unique tables.

| test                 | `noref=false` (ms) | `noref=true` (ms) |
| -------------------- | ------------------ | ----------------- |
| unique tables (50)   | 6.59               | 2.62              |
| shared tables (50)   | 3.24               | 6.40              |
| unique tables (2000) | 23381.48           | 2884.53           |
| shared tables (2000) | 3505.54            | 14038.80          |

The results are basically the inverse of each other where `noref` is
much more performance on tables with unique fields, and `not noref` is
more performant on tables that reuse fields.
2024-01-03 19:17:52 +00:00
dundargoc
b3eda5e73f docs: small fixes
Co-authored-by: Christian Clason <c.clason@uni-graz.at>
Co-authored-by: HiPhish <hiphish@posteo.de>
Co-authored-by: JD Rudie <rudiejd@miamioh.edu>
2024-01-02 22:00:06 +01:00
Mathias Fußenegger
91d76ac941
docs(lsp): add supports_method to vim.lsp.client docs (#26852) 2024-01-02 18:52:29 +01:00
Jongwook Choi
4e9298ecdf refactor(gen_vimdoc): generate function doc from metadata, not from xml
Problem:

For function definitions to be included in the vimdoc (formatted) and
to be exported as mpack data (unformatted), we had two internal
representations of the same function/API metadata in duplicate;
one is FunctionDoc (which was previously a dict), and the other is
doxygen XML DOM from which vimdoc (functions sections) was generated.

Solution:

We should have a single path and unified data representation
(i.e. FunctionDoc) that contains all the metadata and information about
function APIs, from which both of mpack export and vimdoc are generated.
I.e., vimdocs are no longer generated directly from doxygen XML nodes,
but generated via:

  (XML DOM Nodes) ------------> FunctionDoc ------> mpack (unformatted)
                   Recursive     Internal     |
                   Formatting    Metadata     +---> vimdoc (formatted)

This refactoring eliminates the hacky and ugly use of `fmt_vimhelp` in
`fmt_node_as_vimhelp()` and all other helper functions! This way,
`fmt_node_as_vimhelp()` can simplified as it no longer needs to handle
generating of function docs, which needs to be done only in the topmost
level of recursion.
2024-01-02 11:32:32 -05:00