PROBLEM: The builtin python3 provider cannot auto-detect python3.12
when g:python3_host_prog is not set. As a result, when python3 on $PATH
is currently python 3.12, neovim will fail to load python3 provider
and result in `has("python3") == 0`, e.g.,
"Failed to load python3 host. You can try to see what happened by ..."
ROOT CAUSE: the `system()` call from `provider#pythonx#DetectByModule`
does not ignore python warnings, and `pkgutil.get_loader` will print
a warning message in the very first line:
```
<string>:1: DeprecationWarning: 'pkgutil.get_loader' is deprecated and
slated for removal in Python 3.14; use importlib.util.find_spec() instead
```
SOLUTION:
- Use `importlib.util.find_spec` instead (python >= 3.4)
- Use `-W ignore` option to prevent any potential warning messages
runtime(netrw): fix filetype detection for remote editing files
closes: vim/vim#12990closes: vim/vim#12992
this partially reverses commit 71badf9 by commenting out the line that
intentionally sets the filetype to an empty string.
d8b86c937a
Co-authored-by: Christian Brabandt <cb@256bit.org>
runtime(tohtml): Update TOhtml to version 9.0v2 (vim/vim#13050)
Modified behavior:
- Change default value of g:html_use_input_for_pc from "fallback" to
"none". This means with default settings, only the standards-based
method to make special text unselectable is used. The old method
relying on unspecified browser behavior for <input> tags is now only
used if a user specifically enables it.
- Officially deprecate g:use_xhtml option (in favor of
g:html_use_xhtml) by issuing a warning message when used.
Bugfixes:
- Fix issue vim/vim#8547: LineNr and other special highlight groups did not
get proper style rules defined when using "hi link".
- Fix that diff filler was not properly added for deleted lines at the
end of a buffer.
Other:
- Refactored function definitions from long lists of strings to use
:let-heredoc variable assignment instead.
- Corrected deprecated "." string concatenation operator to ".."
operator in more places.
86cfb39030
Co-authored-by: fritzophrenic <fritzophrenic@gmail.com>
runtime(ftplugin): allow to exec if curdir is in PATH
In case the current directory is present as valid $PATH entry, it is OK
to call the program from it, even if vim curdir is in that same
directory.
(Without that patch, for instance, you will not be able to open .zip
files while your current directory is /bin)
closes: vim/vim#1302767c951df4c
Co-authored-by: Anton Sharonov <anton.sharonov@gmail.com>
Problem: runtime files may execute code in current dir
Solution: only execute, if not run from current directory
The perl, zig and ruby filetype plugins and the zip and gzip autoload
plugins may try to load malicious executable files from the current
working directory. This is especially a problem on windows, where the
current directory is implicitly in your $PATH and windows may even run a
file with the extension `.bat` because of $PATHEXT.
So make sure that we are not trying to execute a file from the current
directory. If this would be the case, error out (for the zip and gzip)
plugins or silently do not run those commands (for the ftplugins).
This assumes, that only the current working directory is bad. For all
other directories, it is assumed that those directories were
intentionally set to the $PATH by the user.
816fbcc262
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem: When double clicking a line starting with a #, the code assumes
there is a fold there and tries to close it, resulting in an error if
there isn't a fold.
Solution: Check foldlevel before performing "zc".
Runtime(javascript): add new document properties to completion file
closes: vim/vim#6536a0fddaa2f4
Co-authored-by: Jay Sitter <jay@diameterstudios.com>
Farewell to Bram and dedicate upcoming Vim 9.1 to him (vim/vim#12749)
e978b4534a
Also update the header for the following files that were converted to Vim9
script upstream:
- autoload/ccomplete.lua (vim9jitted)
- ftplugin.vim
- ftplugof.vim
- indent.vim
- indent/vim.vim
- makemenu.vim
This also updates the "Last Change" dates, even if some changes (due to rewrites
to Vim9 script) were not ported.
There's still a few other places where Bram is still mentioned as a maintainer
in the files we and Vim have:
- ftplugin/bash.vim
- indent/bash.vim
- indent/html.vim
- indent/mail.vim
- macros/accents.vim
- macros/editexisting.vim
- syntax/bash.vim
- syntax/shared/typescriptcommon.vim
- syntax/tar.vim
- syntax/typescript.vim
- syntax/typescriptreact.vim
- syntax/zimbu.vim
Maybe future patches will address that.
Also exclude changes to .po files that didn't apply automatically (the
`:messages` maintainer string isn't used in Nvim anyway).
Co-authored-by: Christian Brabandt <cb@256bit.org>
Problem:
If clipboard job exits by signal, the exit code is >=128:
939d9053bd
xclip 0.13 often exits with code 143, which spams unhelpful messages:
clipboard: error invoking xclip: Waiting for selection requests,
Control-C to quit Waiting for selection request number 1
Solution:
Don't show a warning if the clipboard tool exit code is >=128.
Fixes: #7054
Vimball is an outdated feature that is rarely used these days. It is not
a maintenance burden on its own, but it is nonetheless dead weight and
something we'd need to tell users to ignore when they inevitably ask
what it is.
See: https://github.com/neovim/neovim/pull/21369#issuecomment-1347615173
Problem:
"tmux 3.2a" (output from "tmux -V") is not parsed easily.
Solution:
With `strict=false`, discard everything before the first digit.
- rename Semver => Version
- rename vim.version.version() => vim.version._version()
- rename matches() => has()
- remove `opts` from cmp()
TODO:
Unfortunately, cannot (yet) use vim.version for tmux version comparison,
because `vim.version.parse(…,{strict=false})` does not coerce tmux's
funny "tmux 3.3a" version string.
6969d3d749/runtime/autoload/provider/clipboard.vim (L148)
This is the first PR featuring a conversion of an upstream vim9script file
into a Lua file.
The generated file can be found in `runtime/autoload/ccomplete.vim` in
the vim repository. Below is a limited history of the changes of that file
at the time of conversion.
```
❯ git log --format=oneline runtime/autoload/ccomplete.vim
c4573eb12dba6a062af28ee0b8938d1521934ce4 Update runtime files
a4d131d11052cafcc5baad2273ef48e0dd4d09c5 Update runtime files
4466ad6baa22485abb1147aca3340cced4778a66 Update runtime files
d1caa941d876181aae0ebebc6ea954045bf0da24 Update runtime files
20aac6c1126988339611576d425965a25a777658 Update runtime files.
30b658179962cc3c9f0a98f071b36b09a36c2b94 Updated runtime files.
b6b046b281fac168a78b3eafdea9274bef06882f Updated runtime files.
00a927d62b68a3523cb1c4f9aa3f7683345c8182 Updated runtime files.
8c8de839325eda0bed68917d18179d2003b344d1 (tag: v7.2a) updated for version 7.2a
...
```
The file runtime/lua/_vim9script.lua only needs to be updated when vim9jit is updated
(for any bug fixes or new features, like implementing class and interface, the latest in vim9script).
Further PRs will improve the DX of generated the converted lua and
tracking which files in the neovim's code base have been generated.
Update runtime files
86b4816766
vim-patch:9.0.1029: autoload directory missing from distribution
Problem: Autoload directory missing from distribution.
Solution: Add the autoload/zig directory to the list of distributed files.
84dbf855fb
Co-authored-by: Bram Moolenaar <Bram@vim.org>
- If Nvim was just started, don't create a new tab.
- Name the buffer "health://".
- Use "help" syntax instead of "markdown". It fits better, and
eliminates various workarounds.
- Simplfy formatting, avoid visual noise.
- Don't print a "INFO" status, it is noisy.
- Drop the ":" after statuses, they are already UPPERCASE and highlighted.
Error detected while processing function tutor#TutorCmd[38]..BufReadPost Autocommands for "*":
Error executing lua callback: ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: Error ex
ecuting lua: ...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:22: Vim(let):E158: Invalid bu
ffer name: .
stack traceback:
[C]: in function 'nvim_cmd'
...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:22: in function <...llar/neovim/HE
AD-cc5b736/share/nvim/runtime/filetype.lua:21>
[C]: in function 'nvim_buf_call'
...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: in function <...llar/neovim/HE
AD-cc5b736/share/nvim/runtime/filetype.lua:10>
stack traceback:
[C]: in function 'nvim_buf_call'
...llar/neovim/HEAD-cc5b736/share/nvim/runtime/filetype.lua:21: in function <...llar/neovim/HE
AD-cc5b736/share/nvim/runtime/filetype.lua:10>
Closes https://github.com/neovim/neovim/issues/20920
Since version 3.2 tmux has had the ability to read/write buffer contents
from/to the system clipboard, if the underlying terminal emulator
supports it. Enable this feature when we can detect that tmux supports
it.
Current RGB verification parses `tmux server-info`. Despite it being a tmux default alias to `tmux show-messages -JT`, it may be unavailable. Use `tmux show-messages -JT` directly instead.
Made obsolete by now graduated `filetype.lua` (enabled by default).
Note that changes or additions to the filetype detection still need to
be made through a PR to vim/vim as we port the _logic_ as well as tests.
vim-patch:9.0.0771: cannot always tell the difference beween tex and rexx files
Problem: Cannot always tell the difference beween tex and rexx files.
Solution: Recognize tex by a leading backslash. (Martin Tournoij,
closesvim/vim#11380)
bd053f894b
vim-patch:9.0.0055: bitbake files are not detected
Problem: Bitbake files are not detected.
Solution: Add bitbake filetype detection by file name and contents. (Gregory
Anders, closesvim/vim#10697)
fa49eb4827
Problem:
https://github.com/neovim/neovim/pull/18720#issuecomment-1142614996
The vim.health module is detected as a healthcheck, which produces spurious errors:
vim: require("vim.health").check()
========================================================================
- ERROR: Failed to run healthcheck for "vim" plugin. Exception:
function health#check, line 20
Vim(eval):E5108: Error executing lua [string "luaeval()"]:1: attempt to call field 'check' (a nil value)
stack traceback:
[string "luaeval()"]:1: in main chunk
Solution:
Skip vim.health when discovering healthchecks.
Problem:
q in "$MANPAGER mode" does not quit Nvim. This is because
ftplugin/man.vim creates its own mapping:
nnoremap <silent> <buffer> <nowait> q :lclose<CR><C-W>c
which overrides the one set by the autoload file when using :Man!
("$MANPAGER mode")
Solution:
Set b:pager during "$MANPAGER mode" so that ftplugin/man.vim can set the
mapping correctly.
Fixes#18281
Ref #17791
Helped-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
Problem:
I had some issues where multiple plugins (vim-fzf and fugitive) was slow
because of my `.zshenv`.
Solution:
Check shell performance in :checkhealth.
Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
This reverts commit 526798a941.
This will make man filetype not modifiable by default, as it is the
superior behavior in my opinion. More importantly, also make it possible
for a user to modify man filetypes by adding `set modifiable` in
`~/.config/nvim/ftplugin/man.vim` or its equivalent.
ref #11450closes#17595
Co-authored-by: Javier López <graulopezjavier@gmail.com>
Problem: KRL files using "deffct" not recognized.
Solution: Adjust the pattern used for matching. (Patrick Meiser-Knosowski,
closesvim/vim#10200)
93c7a45e86
Problem: Supercollider filetype not recognized.
Solution: Match file extentions and check file contents to detect
supercollider. (closesvim/vim#10142)
8cac20ed42
Problem: Kuka Robot Language files not recognized.
Solution: Recognize *.src and *.dat files. (Patrick Meiser-Knosowski,
closesvim/vim#10096)
3ad2090316
Change missing provider plugins from errors to warnings for python and
perl. Also give proper advice under the ADVICE section instead of just
the errors.
Problem: Dtrace files are recognized as filetype D.
Solution: Add a pattern for Dtrace files. (Teubel György, closesvim/vim#9841)
Add some more testing.
4d56b971cb
Problem: Search() cannot skip over matches like searchpair() can.
Solution: Add an optional "skip" argument. (Christian Brabandt, closesvim/vim#861)
adc17a5f9d
Enable skip arg usage in autoload/freebasic.vim
evalarg_T doesn't really matter because it's deleted in v8.2.0918 (and
reincarnated for Vim9 script in v8.2.1047), but I found out too late :P Anyway:
- Port evalarg_T into eval.h and use const char * and Callback fields
- Use EVALARG_INIT to initialize
- Return bool over OK/FAIL from evalarg functions
- Remove check from evalarg_clean as callback_free ignores None callbacks anyway
- Move eva_buf field into evalarg_get as a local (not sure what reason it has
being in the struct)
N/A patches for version.c:
vim-patch:8.2.4355: unnecessary call to check_colorcolumn()
Problem: Unnecessary call to check_colorcolumn().
Solution: Remove the call. (Sean Dewar, closesvim/vim#9748)
0f7ff851cb
Problem: Basic and form filetype detection is incomplete.
Solution: Add a separate function for .frm files. (Doug Kearns, closesvim/vim#9675)
c570e9cf68
These versions of python has reached End-of-life. getting rid
of python2 support removes a lot of logic to support two
incompatible python versions in the same version.
When `man -w` is called with an empty string as section name, it may
fail with an error code, which causes :Man to no longer work without a
section. Just remove that argument when no section is specified.
* vim-patch:8.2.4064: foam files are not detected
Problem: Foam files are not detected.
Solution: Detect the foam filetype by the path and file contents. (Mohammed
Elwardi Fadeli, closesvim/vim#9501)
2284f6cca3
* Port foam ft detection to filetype.lua
Co-authored-by: Gregory Anders <greg@gpanders.com>
Fixes man.vim's searching on some systems (namely mandoc) where
previously it would not respect the value of b:man_default_sects. It now
properly parses man pages on these systems.
datetime.datetime.timestamp does not exist on Windows and
datetime.datetiem.strftime('%s') is not supported, since '%s' is a POSIX
format. Instead, use the recommended `calendar.timegm(obj.utctimetuple())`.
Problem: Dep3patch files are not recognized.
Solution: Recognize dep3patch files by their location and content. (James
McCoy, closesvim/vim#9367)
647ab4cede
PostgreSQL ships with man pages for SQL statements like `CREATE TABLE`,
which are provided with underscores as `man 7 CREATE_TABLE`. This patch
updates `man#open_page` (as used by `:Man`) such that visually selecting
the words `CREATE TABLE` in SQL code and pressing `K` properly opens the
desired man page.
Writing `:Man CREATE TABLE` still does not work, since `CREATE` is
interpreted as a section name. (Similarly, `:Man CREATE TABLE AS` fails
because there are too many arguments to `:Man`.) But this is okay,
because if you're typing it anyway then you can just enter underscores
and also tab-completion properly suggests `:Man CREATE_TABLE(7)`.
This is a bit bespoke, but my box has over 9000 man pages (as reported
by `man -k '' | wc -l`), and not one of them has a space in the man page
name, whereas the Postgres manuals do exist and are actually useful.
Test Plan:
On a machine with Postgres manual pages, running
nvim -u NORC +'exe "norm iCREATE TABLE foo(x int);" | norm 0veeK'
should open the appropriate man page.
wchargin-branch: man-spaces-to-underscores
Problem: Some plugins have structure `lua/nvim-someplugin/..`
Since `-` is not allowed in vim function names, healthcheck names in
lua and in vim can not have the same name (typically vim will use `_`
instead of `-`).
Solution: Normalize the names before checking for duplicates.
* fix(runtime/health): mitigate issues with duplicate healthchecks
Previously if a healthcheck was found as Lua and Vim it was executed
both times.
This new implementations prefers Lua, therefore if two are found It only
runs the Lua one, this way a plugin can mantain both implementations the
Lua one with the method `check()` and the autoload function `#check()`
(for none HEAD nvim versions).
**Note: This will require plugins to use `check()` as the function name,
since the autoload function that wraps the lua implementation won't be
called**
* docs(health): use spaces and don't overuse backtics
followup to #15259
- Refactor health.vim to discover lua healthcheck in the runtime
directories lua/**/health{/init}.lua
- Support healthchecks for lua submodules e.g :checkhealth vim.lsp and
also support wildcard "*" at the end for all submodules
:checkhealth vim*
- Refactor health.vim to use variable scope instead of output capturing
- Create health.lua module to wrap report functions and future
extensibility.
- Move away from searching just in the runtimepath, use
`nvim_get_runtime_file` due to #15632
Example:
Plugin linter in rtp can declare it's checkhealts in lua module
`lua/linter/health{/init}.lua` that returns a table with a method
"check" that when executed calls the report functions provided by the
builtin lua module require("health").
The plugin also has a submodule `/lua/linter/providers` in which it
defines `/lua/linter/providers/health{/init}.lua`
This plugin healthcheck can now be run by the ex command:
`:checkhealth linter linter.providers`
Also calling all submodules can be done by:
`:checkhealth linter*
And "linter" and "linter.provider" would be discovered when:
`:checkhealth`
Now remove the addition of "start/*" packages in 'packpath' as
explicit items in 'runtimepath'. This avoids 'runtimepath' from becoming
very long when using a lot of plugins as packages.
To get the effective search path as a list, use |nvim_list_runtime_paths()|
Problem:
`buftype=help` occasionally propagates from help to man buffer. As a result the
next time you open help it opens in the man window, replacing the manpage.
Test case:
nvim -u NORC
:Man man
:set bt? " should print `buftype=nofile`
:help
<C-W><C-W><C-W>c " go back to :Man window and close it
:help " focus help window
:Man man " open window with manpage again
:set bt? " prints `buftype=help`
Solution:
- call s:set_options()
- man#read_page() (called by autocmd BufReadCmd man://*) should already do
this. But BufReadCmd doesn't fire for already-existing man:// buffers.
Fix#15650
Problem:
"set filetype=man" assumes the user wants :Man features, this does extra
stuff like renaming the buffer as "man://".
Solution:
- old entrypoint was ":set filetype=man", but this is too presumptuous #15487
- make the entrypoints more explicit:
1. when the ":Man" command is run
2. when a "man://" buffer is opened
- remove the tricky b:man_sect checks in ftplugin/man.vim and syntax/man.vim
- MANPAGER is supported via ":Man!", as documented.
fixes#15487
Block copy and paste from system-clipboard currently breaks formatting.
This fixes it.
The bug occurs because system-clipboard doesn't contain information
about what mode the copy was made.
Simple solution to this is we keep a cache of copy we last made along
with mode information. If system-clipboard returns the cache we apply
the mode information that we know about that cache.
Update runtime files.
cb80aa2d53
Omit runtime/doc/tabpage.txt.
Patch v8.2.1401 is not ported yet.
Port optwin.vim changes without gettext().
Patch v8.2.1544 is not ported yet.
The current guidance for install Python packages is to use
python -m pip install <package_name>
Instead of
pip install <package_name>
This ensures that one is using the version of pip that is tied to the
environment's interpreter (and, thusly, its packages). This has [been
endorsed by a core
maintainer](https://snarky.ca/why-you-should-use-python-m-pip/) as
being the recommended way to invoke pip.
As there currently are a few places where the old invocation was used,
attempt to bring them in line.
Fixes#14234