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>
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.
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#6796closes: vim/vim#811568a8947069
- 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>
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>
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#12166e79e207760
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>
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>
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.
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. (Fixesvim/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#1275993197fde0f
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
- 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`.
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
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.
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#13792closes: vim/vim#138165d5cbb2b9a
Co-authored-by: Christian Brabandt <cb@256bit.org>
runtime(netrw): Decode multibyte percent-encoding filename correctly (vim/vim#13842)
Use `printf("%c")` instead of `nr2char()` to handle '%xx' as a byte.
Closevim/vim#137872357765304
Co-authored-by: K.Takata <kentkt@csc.jp>
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>
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#13776closesvim/vim#13825124371c5a1
Co-authored-by: Romain Lafourcade <romain.lafourcade@razorfish.fr>
runtime(tar): fix a few problems with the tar plugin
From: vim/vim#138331:
- Updating .tar.zst files was broken. Fixesvim/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#12639fixes: vim/vim#8105closes: vim/vim#8109closes: vim/vim#12637closes: vim/vim#138313a5b3df776
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>
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>
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().
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*.
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#13514closes: vim/vim#13523ad4d7f446d
Co-authored-by: Christian Brabandt <cb@256bit.org>
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#1369281642d9d6f
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
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
Problem: The maximum 'statuscolumn' width and grow behavior is undocumented.
Solution: Define, use and document the maximum 'statuscolumn' width and grow behavior.
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.
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>
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#1370083ad2726ff
Co-authored-by: Gregory Anders <greg@gpanders.com>
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.
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.