Commit Graph

6322 Commits

Author SHA1 Message Date
Gregory Anders
08847a9ea1
refactor: move defaults into separate module (#25929)
Move default mappings and autocommands into a separate module and add
comments and docstrings to document each of the defaults.
2023-11-08 09:33:37 -06:00
bfredl
1b0fd377ab
Merge pull request #25767 from luukvbaal/signdel
feat(extmarks): add 'invalidate' property
2023-11-08 12:17:25 +01:00
Luuk van Baal
4e6f559b8c feat(extmarks): add 'invalidate' property to extmarks
Problem:  No way to have extmarks automatically removed when the range it
          is attached to is deleted.
Solution: Add new 'invalidate' property that will hide a mark when the
          entirety of its range is deleted. When "undo_restore" is set
          to false, delete the mark from the buffer instead.
2023-11-08 02:53:49 +01:00
Gregory Anders
748bc4d22d feat(clipboard): add OSC 52 clipboard support
This is opt-in as not all terminal emulators support OSC 52, so it is up
to the user to enable it explicitly.
2023-11-07 08:25:33 -06:00
zeertzjq
6f936c9d85
fix(man): make :Man with a range work (#25922) 2023-11-07 10:39:27 +08:00
altermo
3198038224
fix(lua): correct return value for on_key with no arguments (#25911) 2023-11-07 08:33:38 +08:00
Gregory Anders
56627ca242
feat(tui): use TermResponse event for OSC responses (#25868)
When the terminal emulator sends an OSC sequence to Nvim (as a response
to another OSC sequence that was first sent by Nvim), populate the OSC
sequence in the v:termresponse variable and fire the TermResponse event.
The escape sequence is also included in the "data" field of the
autocommand callback when the autocommand is defined in Lua.

This makes use of the already documented but unimplemented TermResponse
event. This event exists in Vim but is only fired when Vim receives a
primary device attributes response.

Fixes: https://github.com/neovim/neovim/issues/25856
2023-11-06 12:42:40 -06:00
zeertzjq
0774d0cfe1
vim-patch:da4e433dc3be (#25912)
runtime(doc): document vim-script library function

da4e433dc3

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-06 19:03:08 +08:00
Christian Clason
bbd7ec9e64 vim-patch:caee7956a21a
runtime(keymap): Switch Hindu-Arabic to Arabic numerals in arabic keymap (vim/vim#13430)

caee7956a2

Co-authored-by: avidseeker <avidseeker7@protonmail.com>
2023-11-05 21:56:56 +01:00
Christian Clason
b329a21bd3 vim-patch:3d37231437fc
runtime(tar): improve the error detection

Do not rely on the fact, that the last line matches warning, error,
inappropriate or unrecognized to determine if an error occurred. It
could also be a file, contains such a keyword.

So make the error detection slightly more strict and only assume an
error occured, if in addition to those 4 keywords, also a space matches
(this assumes the error message contains a space), which luckily on Unix
not many files match by default.

The whole if condition seems however slightly dubious.  In case an error
happened, this would probably already be caught in the previous if
statement, since this checks for the return code of the tar program.

There may however be tar implementations, that do not set the exit code
for some kind of error (but print an error message)? But let's keep this
check for now, not many people have noticed this behaviour until now, so
it seems to work reasonably well anyhow.

related: vim/vim#6425
fixes: vim/vim#13489

3d37231437

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-05 21:56:56 +01:00
Christian Clason
dcf5999fcd vim-patch:b2a4c110a5d1
runtime(dist): Make dist/vim.vim work properly when lacking vim9script support (vim/vim#13487)

`:return` cannot be used outside of `:function` (or `:def`) in older Vims
lacking Vim9script support or in Neovim, even when evaluation is being skipped
in the dead `:else` branch.

Instead, use the pattern described in `:h vim9-mix`, which uses `:finish` to end
script processing before it reaches the vim9script stuff.

b2a4c110a5

Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
2023-11-05 21:52:02 +01:00
Christian Clason
2a47dbe228 vim-patch:4f174f0de90b
runtime(dist): add legacy version for central vim library

Also, enable the zip and gzip plugins by default, unless those variables
were not explicitly set by the user.

related: vim/vim#13413

4f174f0de9

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-11-05 21:52:02 +01:00
Christian Clason
26cdff0e92 vim-patch:cd8a3eaf5348
runtime(dist): centralize safe executable check and add vim library (vim/vim#13413)

Follow up to 816fbcc26 (patch 9.0.1833: [security] runtime file fixes,
2023-08-31) and f7ac0ef50 (runtime: don't execute external commands when
loading ftplugins, 2023-09-06).

This puts the logic for safe executable checks in a single place, by introducing
a central vim library, so all filetypes benefit from consistency.

Notable changes:
- dist#vim because the (autoload) namespace for a new runtime support
  library. Supporting functions should get documentation. It might make
  life easier for NeoVim devs to make the documentation a new file
  rather than cram it into existing files, though we may want
  cross-references to it somewhere…
- The gzip and zip plugins need to be opted into by enabling execution
  of those programs (or the global plugin_exec). This needs
  documentation or discussion.
- This fixes a bug in the zig plugin: code setting s:tmp_cwd was removed
  in f7ac0ef50 (runtime: don't execute external commands when loading
  ftplugins, 2023-09-06), but the variable was still referenced. Since
  the new function takes care of that automatically, the variable is no
  longer needed.

cd8a3eaf53

Co-authored-by: D. Ben Knoble <ben.knoble+github@gmail.com>
2023-11-05 21:52:02 +01:00
bfredl
68cb4a7405 feat(extmarks): add "undo_restore" flag to opt out of undo-restoring
It is a design goal of extmarks that they allow precise tracking
of changes across undo/redo, including restore the exact positions
after a do/undo or undo/redo cycle. However this behavior is not useful
for all usecases. Many plugins won't keep marks around for long after
text changes, but uses them more like a cache until some external source
(like LSP semantic highlights) has fully updated to changed text and
then will explicitly readjust/replace extmarks as needed.

Add a "undo_restore" flag which is true by default (matches existing
behavior) but can be set to false to opt-out of this behavior.

Delete dead u_extmark_set() code.
2023-11-05 12:18:29 +01:00
L Lllvvuu
6c150e0b93 docs(treesitter): add disclaimer about needing to parse before get_node()
Problem:
---
Misuse of `get_node()` is common:
https://github.com/search?q=get_node_at_cursor+language%3Alua&type=code

Solution:
---
Add a note clarifying proper usage.
2023-11-04 14:55:44 +01:00
Christian Clason
d3e9cbedc7 vim-patch:ce3b0136c6d9
runtime(sh): Update sh syntax and add shDerefOffset to shDerefVarArray for bash (vim/vim#13480)

Add shDerefOffset to shDerefVarArray.

Example code:

```bash
declare -a a=({a..z})

echo "${a[@]:1:3}"
```

ce3b0136c6

Co-authored-by: Lucien Grondin <grondilu@yahoo.fr>
2023-11-04 12:55:54 +01:00
Christian Clason
e960fa2412 vim-patch:2f54c13292af
runtime(script.vim): make strace ft check less strict (vim/vim#13482)

Strace output, depending on parameters (-ttf this time), can dump both
times and pid:
  1038  07:14:20.959262 execve("./e.py", ["./e.py"], 0x7ffca1422840 /* 51 vars */) = 0 <0.000150>

So loose the regexp matching this, so that the above is matched too.

Fixes vim/vim#13481.

2f54c13292

Co-authored-by: Jiri Slaby <jirislaby@gmail.com>
Co-authored-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
2023-11-04 12:55:25 +01:00
Mathias Fussenegger
9281edb334 fix(lsp): create per client params in lsp.buf.code_action
`code_action` used the same parameters for all clients, which led to the
following warning and incorrect start/end column locations if using
clients with mixed encodings:

    warning: multiple different client offset_encodings detected for
    buffer, this is not supported yet
2023-11-04 08:17:42 +01:00
Christian Clason
d4dc1355ed vim-patch:1858e2b22ad1
runtime(sh) Update sh syntax and add shDblParen to shCaseList (vim/vim#13469)

1858e2b22a

Co-authored-by: Lucien Grondin <grondilu@yahoo.fr>
2023-11-03 10:04:55 +01:00
Christian Clason
80cf1ee2c5 vim-patch:2b89afd5eb63
runtime(debversions): Add noble (24.04 LTS) as Ubuntu release name (vim/vim#13472)

2b89afd5eb

Co-authored-by: James McCoy <jamessan@jamessan.com>
2023-11-03 10:04:55 +01:00
dundargoc
5a2543c159
docs: small fixes (#25831)
Co-authored-by: Peter Aronoff <peter@aronoff.org>
2023-11-03 07:22:02 +08:00
George Harker
4e6096a67f
feat(server): allow embed with listen (#25709)
connection from any channel or stdio will unblock
remote_ui_wait_for_attach.  Wait on stdio only if
only —embed specified, if both —embed and
—listen then wait on any channel.
2023-11-01 11:04:53 +08:00
Gregory Anders
224f303ee5
feat(stdlib): add vim.base64 module (#25843)
Add base64 encode() and decode() functions to a vim.base64 module.
2023-10-31 09:15:32 -05:00
Evgeni Chasnovski
adbe7f3683
fix(lsp): call on_list() even for single location (#25830)
Problem: Currently there is no way of customizing behavior of
  `declaration`, `definition`, `typeDefinition`, and `implementation`
  methods in `vim.lsp.buf` when LSP server returns `Location`. Instead,
  cursor jumps to that location directly.

Solution: Normalize LSP response to be `Location[]` for those four cases.
2023-10-31 13:18:44 +01:00
bfredl
6d1a2f2c3c
Merge pull request #25674 from famiu/refactor/options/unify_string_options
refactor(options): unify `set_option` and `set_string_option`
2023-10-30 20:06:57 +01:00
Famiu Haque
e19cc9c9b7 refactor(options)!: unify set_option and set_string_option
While the interfaces for setting number and boolean options are now unified by #25394, there is still a separate `set_string_option` function that is used for setting a string option. This PR removes that function and merges it with set_option.

BREAKING CHANGE: `v:option_old` is now the old global value for all global-local options, instead of just string global-local options. Local value for a global-local number/boolean option is now unset when the option is set (e.g. using `:set` or `nvim_set_option_value`) without a scope, which means they now behave the same way as string options.

Ref: #25672
2023-10-30 21:38:02 +06:00
Maria José Solano
0fe0cf5ada
fix(lsp): do not cancel snippet when selecting placeholder (#25835) 2023-10-30 12:58:28 +01:00
dundargoc
2dc9ceb99c
docs: small fixes (#25585)
Co-authored-by: tmummert <doczook@gmx.de>
Co-authored-by: parikshit adhikari <parikshitadhikari@gmail.com>
2023-10-29 16:02:32 +08:00
Christian Clason
a5629abce2 vim-patch:a390e984db20
runtime(sh): add shDblParen to shLoopList for bash (vim/vim#13445)

add shDblParen to shLoopList to correctly highlight
arithmetic expressions for Bash and Ksh

This should allow code such as:

```bash
declare -i i j
for i in foo bar
do ((j = 1 << j))
done
```

a390e984db

Co-authored-by: Lucien Grondin <grondilu@yahoo.fr>
2023-10-29 01:37:07 +02:00
Christian Clason
c34e816608 vim-patch:9.0.2079: Not all Dart files detected
Problem:  Not all Dart files detected
Solution: Add shebang filetype detection for Dart

closes: vim/vim#13449

c1c177a47b

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-10-29 01:36:51 +02:00
zeertzjq
a2a1a65b98
vim-patch:8ebdbc9e6d80 (#25816)
runtime(doc): all secure options should note this restriction in the documentation (vim/vim#13448)

Problem:  Not all secure options document their status
Solution: Describe secure context :set restrictions in each help entry

8ebdbc9e6d

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-29 06:15:13 +08:00
Christian Clason
9455f6b17c vim-patch:650dcfc8d12e
runtime(netrw): don't echo empty lines (vim/vim#13431)

650dcfc8d1

Co-authored-by: nwounkn <nwounkn@gmail.com>
2023-10-28 00:24:40 +02:00
Jongwook Choi
add1b10b79
fix(diagnostic): virtual_text prefix function should have index and total (#25801)
The prefix option of the diagnostic virtual text can be a function,
but previously it was only a function of diagnostic.

This function should also have additional parameters index and total,
more consistently and similarily as in the prefix function for
`vim.diagnostic.open_float()`.

These additional parameters will be useful when there are too many
number of diagnostics in a single line.
2023-10-27 08:17:46 -05:00
Christian Clason
4fcdfa5ad0 vim-patch:7b7cda67a124
runtime(debian): update debian related runtime files (vim/vim#13423)

* Update Debian runtime files

Add mantic as a supported Ubuntu release and move buster/kinetic to
unsupported.

Add syntax highlighting for deb822sources filetype.

Add debsources ftplugin to set relevant comment options.

Move common version information to shared/debversions.vim

Closes vim/vim#11934

* Add myself as codeowner for Debian-related runtime files

---------

7b7cda67a1

Co-authored-by: James McCoy <jamessan@jamessan.com>
Co-authored-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Co-authored-by: James Addison <jay@jp-hosting.net>
Co-authored-by: Viktor Szépe <viktor@szepe.net>
Co-authored-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Co-authored-by: James Addison <jay@jp-hosting.net>
Co-authored-by: Viktor Szépe <viktor@szepe.net>
2023-10-27 10:06:52 +02:00
Christian Clason
5753e5e7eb vim-patch:9.0.2071: objdump files not recognized
Problem:  objdump files not recognized
Solution: detect *.objdump files, add a filetype plugin

Added the objdump file/text format

closes: vim/vim#13425

10407df7a9

Co-authored-by: Colin Kennedy <colinvfx@gmail.com>
2023-10-27 10:03:09 +02:00
Lajos Koszti
ba6761eafe
fix(lsp): fix omnicomplete in middle of the line (#25787)
Fixes a regression from 5e5f5174e3

Until that commit we had a logic like this:
`local prefix = startbyte and line:sub(startbyte + 1) or line_to_cursor:sub(word_boundary)`

The commit changed the logic and no longer cut off the line at the cursor,  resulting in a prefix that included trailing characters
2023-10-26 22:40:36 +02:00
Maria José Solano
15983cf2c6
fix(lsp): cancel session when leaving snippet region (#25762) 2023-10-26 07:29:05 +02:00
zeertzjq
f2fc44550f
vim-patch:9.0.2064: cannot use buffer-number for errorformat (#25782)
Problem:  cannot use buffer-number for errorformat
Solution: add support for parsing a buffer number using '%b' in
          'errorformat'

closes: vim/vim#13419

b731800522

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-26 07:42:29 +08:00
zeertzjq
bfe8a39512
vim-patch:partial:5985879e3c36 (#25780)
runtime(doc): Fix typos in several documents (vim/vim#13420)

* Fix typos in several documents
* Update runtime/doc/terminal.txt

5985879e3c

Skip runtime/doc/indent.txt: not ported yet

Co-authored-by: h_east <h.east.727@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
2023-10-26 06:41:54 +08:00
Christian Clason
0b1ec3b162 vim-patch:9.0.2063: pacman hooks are detected as conf filetype
Problem:  pacman hooks are detected as conf filetype
Solution: make it consistent to pacman.conf and detect those
          hooks as confini

Because confini has much better syntax highlighting than conf.

For reference, I identified pacman.conf and pacman hooks as dosini in
https://github.com/vim/vim/pull/6335, then
https://github.com/vim/vim/pull/10213 changed them to conf, then
https://github.com/vim/vim/pull/10518 changed pacman.conf to confini but
forgot to change hooks.

closes: vim/vim#13399

7d254dbc2d

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2023-10-24 10:15:47 +02:00
Christian Clason
4f0adb6a78 vim-patch:9.0.2062: Janet files are not recognised
Problem:  Janet files are not recognised
Solution: Add filename and shebang detection (without
          adding an extra filetype plugin)

Those are used by the Janet language:
http://www.janet-lang.org

closes: vim/vim#13400

c038427d2a

Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2023-10-24 10:15:47 +02:00
Christian Clason
94fee35446 vim-patch:9.0.2061: not able to detect xkb filetypes
Problem:  not able to detect xkb filetypes
Solution: Detect files below /u/s/X11/xkb as xkb files (without adding
          an extra filetype)

Those files are used from the X11 xkb extension

closes: vim/vim#13401

ae9021a840

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2023-10-24 10:15:47 +02:00
Christian Clason
5f0224e848 vim-patch:9.0.2060: *.{gn,gni} files are not recognized
Problem:  *.{gn,gni} files are not recognized
Solution: Detect some as gn filetype (without adding an extra filetype)

Those come from: https://gn.googlesource.com/gn/

closes: vim/vim#13405

84394f2be4

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-10-24 10:15:47 +02:00
Christian Clason
e606604322 vim-patch:fea96c00e55a
runtime(vim): Update ftplugin - comment motions (vim/vim#13412)

Fix the pattern used by comment-motion mappings to match the start of a
block comment.

Block-comment start lines were being ignored if the previous line
contained a double-quote character anywhere in the line.  Line comments
should only be ignored if the previous line is a full-line comment and,
therefore, part of the current block comment.

fea96c00e5

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-23 19:48:50 +02:00
Maria José Solano
94127cb5df fix(lsp): do not add extra indentation 2023-10-23 17:21:41 +02:00
Maria José Solano
370232dbef fix(lsp): track snippet deletion 2023-10-23 17:21:41 +02:00
Mathias Fussenegger
5e5f5174e3 fix(lsp): fix off-by-one error for omnifunc word boundary
Fixes https://github.com/neovim/neovim/issues/25177

I initially wanted to split this into a refactor commit to make it more
testable, but it appears that already accidentally fixed the issue by
normalizing lnum/col to 0-indexing
2023-10-23 08:26:38 +02:00
glepnir
ae4ca4edf8 feat(complete): support f flag for complete buffer part 2023-10-21 20:06:36 +08:00
Mathias Fussenegger
195301c609 refactor(lsp): deprecate completion util methods
Relates to https://github.com/neovim/neovim/issues/25272
2023-10-21 13:49:05 +02:00
Mathias Fussenegger
1e10310f4c refactor(lsp): move completion logic into _completion module
To reduce cross-chatter between modules and for https://github.com/neovim/neovim/issues/25272
Also preparing for https://github.com/neovim/neovim/issues/25714
2023-10-21 13:49:05 +02:00
zeertzjq
9971bea6f1
vim-patch:9.0.2059: outstanding exceptions may be skipped (#25736)
Problem:  outstanding exceptions may be skipped
Solution: When restoring exception state, process remaining outstanding
          exceptions

closes: vim/vim#13386

0ab500dede

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-21 18:46:52 +08:00
zeertzjq
fc02908c97
vim-patch:d3e277f279ed (#25734)
matchparen: do not use hard-coded match id (vim/vim#13393)

* matchparen: do not use hard-coded match id

Instead of using the hard-coded match id 3, which may also be used by
other plugins, let the matchparen plugin use whatever ids are
automatically returned when calling matchaddpos().

For backwards-compatibility, keep the `:3match` call, which will still
use the hard-coded id 3 (as mentioned in :h :3match).

closes: vim/vim#13381

d3e277f279

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-21 18:04:08 +08:00
Maria José Solano
f1775da07f
feat(lsp): add snippet API (#25301) 2023-10-21 08:51:26 +02:00
Jorge Mederos
3304449946
fix(lsp): log unknown diagnostic tags instead of showing a warning (#25705)
To be more in line with the specification:

> To support the evolution of enumerations the using side of an enumeration shouldn’t fail on an enumeration value it doesn’t know. It should simply ignore it as a value it can use and try to do its best to preserve the value on round trips
2023-10-21 08:47:14 +02:00
Christian Clason
f4b896198f vim-patch:9.0.2056: no digraph for quadruple prime
Problem:  no digraph for quadruple prime
Solution: add quadruple prime digraph using 4'

closes: vim/vim#13380

47416d1a74

Co-authored-by: Jonathan Wright <quaggy@gmail.com>
2023-10-20 13:03:36 +02:00
Gregory Anders
594ff34581
vim-patch:d5dc58aeed1b (#25720)
runtime(json5): Add new ftplugin (vim/vim#13385)

d5dc58aeed

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-19 16:22:51 -05:00
Gregory Anders
e6d352d8d7 vim-patch:e08bfef88bd0
runtime(zig): Update Zig runtime files (vim/vim#13388)

Update runtime files from upstream (https://github.com/zig/zig.vim) at
commit 54c216e5306a5c3878a60596aacb94dca8652ab9.

e08bfef88b

Co-authored-by: Gregory Anders <8965202+gpanders@users.noreply.github.com>
2023-10-19 10:20:55 -05:00
Maria José Solano
315c711700 fix(treesitter): set cursor position when opening inspector 2023-10-19 14:54:10 +02:00
Pham Huy Hoang
ae7020c667 fix(docs): fix TSNode incorrect signatures 2023-10-19 09:23:13 +01:00
Christian Clason
eadedfd908 vim-patch:5a33ce2a661f
runtime(json5): include syntax script for json5 (vim/vim#13356)

Merging syntax file from gutenye/json5.vim, modified to include proper
vim header.

See: https://github.com/vim/vim/issues/8499

5a33ce2a66

Co-authored-by: Rolf Vidar Mazunki Hoksaas <32819373+mazunki@users.noreply.github.com>
Co-authored-by: Guten Ye <ywzhaifei@gmail.com>
2023-10-18 09:09:33 +02:00
zeertzjq
bc5dfda441
vim-patch:9.0.2041: trim(): hard to use default mask (#25692)
Problem:  trim(): hard to use default mask (partly revert v9.0.2040)
Solution: use default mask when it is empty

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

Currently, an empty 'mask' will make 'trim()' call return 'text' value
that is passed in unmodified.  It is unlikely that someone is using it,
so the chances of scripts being broken by this change are low.

Also, this reverts commit 9.0.2040 (which uses v:none for the default
and requires to use an empty string instead).

closes: vim/vim#13358

8079917447

vim-patch:9.0.2040: trim(): hard to use default mask

Problem:  trim(): hard to use default mask
Solution: Use default 'mask' when it is v:none

The default 'mask' value is pretty complex, as it includes many
characters.  Yet, if one needs to specify the trimming direction, the
third argument, 'trim()' currently requires the 'mask' value to be
provided explicitly.

'v:none' is already used to mean "use the default argument value" in
user defined functions.  See |none-function_argument| in help.

closes: vim/vim#13363

6e6386716f

Co-authored-by: Illia Bobyr <illia.bobyr@gmail.com>
2023-10-18 06:08:14 +08:00
Maria José Solano
3fd7449d5a
fix(treesitter): check that buf is loaded in autocommands (#25679) 2023-10-17 15:34:39 -05:00
zeertzjq
272ef27115
vim-patch:9.0.2035: [security] use-after-free with wildmenu (#25687)
Problem:  [security] use-after-free with wildmenu
Solution: properly clean up the wildmenu when exiting

Fix wildchar/wildmenu/pum memory corruption with special wildchar's

Currently, using `wildchar=<Esc>` or `wildchar=<C-\>` can lead to a
memory corruption if using wildmenu+pum, or wrong states if only using
wildmenu. This is due to the code only using one single place inside the
cmdline process loop to perform wild menu clean up (by checking
`end_wildmenu`) but there are other odd situations where the loop could
have exited and we need a post-loop clean up just to be sure. If the
clean up was not done you would have a stale popup menu referring to
invalid memory, or if not using popup menu, incorrect status line (if
`laststatus=0`).

For example, if you hit `<Esc>` two times when it's wildchar, there's a
hard-coded behavior to exit command-line as a failsafe for user, and if
you hit `<C-\><C-\><C-N>` it will also exit command-line, but the clean
up code would not have hit because of specialized `<C-\>` handling.

Fix Ctrl-E / Ctrl-Y to not cancel/accept wildmenu if they are also
used for 'wildchar'/'wildcharm'. Currently they don't behave properly,
and also have potentially memory unsafe behavior as the logic is
currently not accounting for this situation and try to do both.
(Previous patch that addressed this: vim/vim#11677)

Also, correctly document Escape key behavior (double-hit it to escape)
in wildchar docs as it's previously undocumented.

In addition, block known invalid chars to be set in `wildchar` option,
such as Ctrl-C and `<CR>`. This is just to make it clear to the user
they shouldn't be set, and is not required for this bug fix.

closes: vim/vim#13361

8f4fb007e4

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-17 22:43:42 +08:00
Jaehwang Jung
35f475d0a5
fix(diagnostics): if buffer not loaded, skip handlers that set extmark (#25628)
Problem:
When enabling diagnostics, there can be diagnostics for unloaded buffer,
but some handlers nevertheless attempt to set extmarks in such buffers.

Solution:
* Exit underline/virtual_text handler if buffer is not loaded.
* Don't require is_loaded as precondition for show(), because handlers
  don't necessarily depend on it.
2023-10-16 20:51:36 -05:00
bfredl
a63c67005b
Merge pull request #25394 from famiu/refactor/options/set_option
refactor(options)!: unify interfaces for setting options
2023-10-16 20:41:35 +02:00
Famiu Haque
5df4fdf253 refactor(options)!: make OptionSet v: values use typval
BREAKING CHANGE: This breaks the OptionSet autocommand, as the `v:` values associated with it (`v:option_new`, `v:option_old`, `v:option_oldlocal` and `v:option_oldglobal`) are now the same type as the option, instead of all option values being converted to strings.
2023-10-17 00:08:47 +06:00
James Barford-Evans
a4c4b39d55
fix(man.lua): hardwrapped manpage is not resized #25646
Problem:
If a manpage is opened, its hardwrapped dimensions are not recalculated
after closing then revisiting the same manpage.

Solution:
Unload the manpage when it is hidden. This forces it to be reloaded,
which forces the hard-wrapping to be recalculated when it is revisited.

Fixes: #25457
2023-10-16 09:59:33 -07:00
Maria José Solano
2eecb1b85d
fix(lsp): highlight active parameter in signature help #25663
Fixes #25662
2023-10-16 08:52:48 -07:00
Maria José Solano
c46a6c065e
docs: do not hardcode LSP version in URL #25648 2023-10-16 08:13:37 -07:00
zeertzjq
3222f0ad00
vim-patch:dbf749bd5aae (#25665)
runtime: Fix more typos (vim/vim#13354)

* Fix more typos

* Fix typos in ignored runtime/ directory

dbf749bd5a

Co-authored-by: Viktor Szépe <viktor@szepe.net>
2023-10-16 16:36:25 +08:00
zeertzjq
75b488d3ef
vim-patch:9.0.2025: no cmdline completion for ++opt args (#25657)
Problem:  no cmdline completion for ++opt args
Solution: Add cmdline completion for :e ++opt=arg and :terminal
          [++options]

closes: vim/vim#13319

989426be6e

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-15 17:52:08 +08:00
zeertzjq
d974a3dcbb
vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653)
Problem:  Cannot accurately get mouse clicking position when clicking on
          a TAB or with virtual text.
Solution: Add a "coladd" field to getmousepos() result.

closes: vim/vim#13335

f5a94d5165
2023-10-15 17:19:01 +08:00
zeertzjq
e5a424d78e
vim-patch:9.0.2030: no max callback recursion limit (#25655)
Problem:  no max callback recursion limit
Solution: bail out, if max call recursion for callback functions
          has been reached.

This checks the 'maxfuncdepth' setting and throws E169 when a callback
function recursively calls itself.

closes: vim/vim#13337
closes: vim/vim#13339

47510f3d65

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-10-15 17:02:17 +08:00
zeertzjq
aa62579a68
docs: restore accidentally removed line in :h 'ignorecase' (#25651) 2023-10-15 09:05:27 +08:00
Christian Clason
28ef4a4492 vim-patch:7687238e1b0d
runtime(tcsh): Update ftplugin (vim/vim#13327)

Fix b:browsefilter deletion error when calling b:undo_ftplugin.

Fixes vim/vim#13167

7687238e1b

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-14 17:07:09 +02:00
Christian Clason
729a9c4c61 vim-patch:9.0.2024: no filetype detection for Debian sources
Problem:  no filetype detection for Debian sources
Solution: Add new deb822sources filetype

closes: vim/vim#13320

bd734c3bea

Co-authored-by: James McCoy <jamessan@jamessan.com>
2023-10-14 16:41:33 +02:00
zeertzjq
20dacacf37
vim-patch:2bbd0d30eebd (#25637)
runtime(doc): Improve command-line completion docs (vim/vim#13331)

* Improve command-line completion docs

Add more details about 'ignorecase' and its effect on cmdline
completion.

Make sure keys used in wildmenu are properly documented and linked in the
keys' documentation entries, and in `:h index` for proper
cross-referencing, as wildmenu popup is slightly different from
insert-mode popup menu.

* Fix docs typos

2bbd0d30ee

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-14 19:28:41 +08:00
zeertzjq
bcda800933
vim-patch:9.0.2022: getmousepos() returns wrong index for TAB char (#25636)
Problem:  When clicking in the middle of a TAB, getmousepos() returns
          the column of the next char instead of the TAB.
Solution: Break out of the loop when the vcol to find is inside current
          char. Fix invalid memory access when calling virtcol2col() on
          an empty line.

closes: vim/vim#13321

b583eda703
2023-10-14 19:18:25 +08:00
Mathias Fußenegger
57ce9b6a92
refactor(lsp): fix luals warnings in tagfunc and add type annotations (#25150) 2023-10-14 11:31:16 +02:00
Mathias Fußenegger
712adacdf5
refactor(lsp): make is_pull in lsp.diagnostic.get_namespace optional (#25156)
Follw up to 63b3408551

`is_pull` should be optional, otherwise it is an API change that
introduces warnings in consumers.

Also fixes the type annotation of `_client_pull_namespaces` where the
key is a string.
2023-10-14 09:47:20 +02:00
Maria José Solano
ee156ca60e
fix(lsp): refactor escaping snippet text (#25611) 2023-10-14 09:06:40 +02:00
zeertzjq
840e1864c2
fix(lsp): handle NUL bytes in popup text (#25612)
Fix #25610
2023-10-12 15:39:39 +08:00
Christian Clason
7474874baa vim-patch:9.0.2011: INI files not detected
Problem:  INI files not detected
Solution: detect uppercase .INI as dosini files

It previo~1 only worked for lower-case .ini files, but upperc~1 .INI is
also somewhat common on account of DOS' old 8.3 upperc~2 only filena~1.

closes: vim/vim#13316

4a82bdfaa8

Co-authored-by: Martin Tournoij <martin@arp242.net>
2023-10-11 23:54:41 +02:00
Maria José Solano
2fde6295df
fix(lsp): display initialization errors (#25409) 2023-10-11 15:38:58 -05:00
sisrfeng
37da0bc0c6
docs: clarify about error in shada (#25594) 2023-10-11 17:58:07 +08:00
Raphael
f79052faef
refactor(float): rename ex_floatclose to ex_fclose (#25596) 2023-10-11 15:03:59 +08:00
Famiu Haque
c4f8be464c docs(style): add guideline for fixing compiler error on switch statement
Problem: Certain compilers (primarily GCC) do not recognize an exhaustive enum switch statement as being exhaustive. This manifests in the form of compiler errors in exhaustive switch statements where each case has a return statement but there isn't a catch-all return statements. These compiler errors are spurious in the context of the Neovim codebase. So #25533 added the `UNREACHABLE` macro to denote apart of the code that's unreachable, which was used after every such switch statement to tell the compiler to treat the switch statement as exhaustive. However, the macro is mentioned nowhere in the style guide,and new contributors would not have any natural way of learning about it as it stands now. This would lead to confusion when they inevitably encounter one of these compiler errors.

Solution: Add a style guideline which shows how to use the `UNREACHABLE` macro to fix these compiler errors.
2023-10-10 22:23:54 +02:00
dundargoc
c3d21ad1bc docs: small fixes
Co-authored-by: Wansmer <wansmer@gmail.com>
Co-authored-by: Andrew Voynov <andrewvoynov.b@gmail.com>
Co-authored-by: David Moberg <david.moberg@mediatek.com>
2023-10-10 19:20:32 +02:00
bfredl
fd39f5ce8c
Merge pull request #25561 from glepnir/9663
feat(float): add fclose command
2023-10-10 16:36:55 +02:00
glepnir
372aa2eb3d feat(float): add fclose command 2023-10-10 21:17:08 +08:00
Famiu Haque
9ff6f73f83 refactor: allow not having a default case for enum
Problem: The style guide states that all switch statements that are not conditional on an enum must have a `default` case, but does not give any explicit guideline for switch statements that are conditional on enums. As a result, a `default` case is added in many enum switch statements, even when the switch statement is exhaustive. This is not ideal because it removes the ability to have compiler errors to easily detect unchanged switch statements when a new possible value for an enum is added.

Solution: Add explicit guidelines for switch statements that are conditional on an enum, clarifying that a `default` case is not necessary if the switch statement is exhaustive. Also refactor pre-existing code with unnecessary `default` cases.
2023-10-10 11:19:41 +01:00
zeertzjq
c40a1c0f41
vim-patch:9.0.2009: cmdline-completion for comma-separated options wrong (#25569)
Problem:  cmdline-completion for comma-separated options wrong
Solution: Fix command-line expansions for options with filenames with
          commas

Fix command-line expansions for options with filenames with commas

Cmdline expansion for option values that take a comma-separated list
of file names is currently not handling file names with commas as the
commas are not escaped. For such options, the commas in file names need
to be escaped (to differentiate from a comma that delimit the list
items). The escaped comma is unescaped in `copy_option_part()` during
option parsing.

Fix as follows:
- Cmdline completion for option values with comma-separated file/folder
  names will not start a new match when seeing `\\,` and will instead
  consider it as one value.
- File/folder regex matching will strip the `\\` when seeing `\\,` to
  make sure it can match the correct files/folders.
- The expanded value will escape `,` with `\\,`, similar to how spaces
  are escaped to make sure the option value is correct on the cmdline.

This fix also takes into account the fact that Win32 Vim handles file
name escaping differently. Typing '\,' for a file name results in it
being handled literally but in other platforms '\,' is interpreted as a
simple ',' and commas need to be escaped using '\\,' instead.

Also, make sure this new logic only applies to comma-separated options
like 'path'. Non-list options like 'set makeprg=<Tab>' and regular ex
commands like `:edit <Tab>` do not require escaping and will continue to
work.

Also fix up documentation to be clearer. The original docs are slightly
misleading in how it discusses triple slashes for 'tags'.

closes: vim/vim#13303
related: vim/vim#13301

54844857fd

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-10 09:15:21 +08:00
zeertzjq
f5eabaa940
fix(path): restore space separation in 'path' (#25571)
Removing this behavior causes more inconsistencies and bugs.
2023-10-10 08:22:32 +08:00
zeertzjq
43f22853fe
docs: fix misplaced mention of 'backupdir' (#25568) 2023-10-10 07:06:34 +08:00
Maria José Solano
c80a3976cb
docs: miscellaneous doc and type fixes (#25554) 2023-10-10 06:34:48 +08:00
Jaehoon Hwang
dacd34364f
feat(ui-ext): make 'mousehide' into proper ui_option (#25532) 2023-10-09 16:48:24 +08:00
Christian Clason
e5855697e9 vim-patch:1e33cd72b60a
runtime: make command name for &iskeywordprg more unique (vim/vim#13297)

See https://github.com/vim/vim/pull/13213/commits by @dkearns:
Rename 'keywordprg' user command to ShKeywordPrg as this is just a
leaking implementation detail.

1e33cd72b6

Co-authored-by: Enno <Konfekt@users.noreply.github.com>
2023-10-08 23:31:49 +02:00
LW
9abced6ad9
fix(lsp): account for border height in max floating popup height (#25539) 2023-10-08 10:09:25 +02:00
Famiu Haque
380870335f docs: use abort() for unreachable default: case in C
Problem: The style guide currently recommends having a `default:` case for switch statements that are not conditional on an enumerated value. Additionally, it recommends using `assert(false)` if `default:` is unreachable. This is problematic because `assert()` only runs on debug builds, which may lead to confusing breakages in release builds. Moreover, this suggestion is followed nowhere in the C code and `abort()` is used everywhere instead.

Solution: Suggest using `abort()` instead of `assert(false)`, that way the program always terminates if a logically unreachable case is reached.
2023-10-07 20:47:55 +06:00
zeertzjq
7e9407490c
Merge pull request #25529 from zeertzjq/vim-9.0.1990
vim-patch:9.0.1990,27e12c7669e3
2023-10-07 07:01:55 +08:00
Christian Clason
e7c268e38f vim-patch:2a281ccca017
runtime(sh): Update ftplugin (vim/vim#13213)

Rename 'keywordprg' user command to ShKeywordPrg as this is just a
leaking implementation detail.

2a281ccca0

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-10-07 00:48:35 +02:00
zeertzjq
92df389f1b vim-patch:27e12c7669e3
runtime(doc): remove E1520 tag (vim/vim#13289)

27e12c7669
2023-10-07 05:54:12 +08:00
zeertzjq
8bb0878013 vim-patch:9.0.1990: strange error number
Problem:  strange error number
Solution: change error number,
          add doc tag for E1507

closes: vim/vim#13270

ea746f9e86

Co-authored-by: Christ van Willegen <cvwillegen@gmail.com>
2023-10-07 05:54:10 +08:00
Aayush Ojha
5db076c7cc
fix(lua): vim.region on linewise selection #25467
fixes #18155
2023-10-06 05:44:50 -07:00
Justin M. Keyes
133e2990ef refactor: cleanup 2023-10-06 14:09:21 +02:00
Leonardo Mello
1dd700a8d9 fix: gf fails on "foo/bar.txt:1:2" on Windows
Problem:
On Windows, "gf" fails on a filepath that has a line:column suffix.
Example:

    E447: Can't find file "src/app/core/services/identity/identity.service.ts:64:23"

Solution:
- Remove ":" from 'isfname' on Windows. Colon is not a valid filename
  character (except for the drive-letter).
- Handle drive letters specially in file_name_in_line().

Fixes #25160
2023-10-06 12:59:58 +02:00
Christian Clason
a6cccd728a vim-patch:0e958410046a
runtime(netrw): diff (`df`) may open the wrong window (vim/vim#13275)

closes: vim/vim#11359

0e95841004

Co-authored-by: KSR-Yasuda <31273423+KSR-Yasuda@users.noreply.github.com>
2023-10-06 10:18:33 +02:00
Christian Clason
ac6d8d0087 vim-patch:f449825ae238
runtime(netrw): Update `.netrwbook` immediately on bookmark change (vim/vim#13276)

closes: vim/vim#9738

f449825ae2

Co-authored-by: KSR-Yasuda <31273423+KSR-Yasuda@users.noreply.github.com>
2023-10-06 10:18:33 +02:00
Christian Clason
1338140ee3 vim-patch:9.0.1978: No filetype detection for just files
Problem:  No filetype detection for just files
Solution: Detect just files (*.just, justfile, etc)

closes: vim/vim#13271

3d90f71b76

vim-patch:b6d01f13: runtime(just): Correct filetype detection pattern and style

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-10-06 09:52:24 +02:00
Christian Clason
0ff13a6a5a vim-patch:4dbb2669e9ed
runtime(netrw): error when trying to :bd unloaded buffer

closes: vim/vim#13215
closes: vim/vim#13082

4dbb2669e9

Co-authored-by: yasuda <yasuda@kyoto-sr.co.jp>
2023-10-05 09:08:17 +02:00
Justin M. Keyes
29fe883aa9
feat: ignore swapfile for running Nvim processes #25336
Problem:
The swapfile "E325: ATTENTION" dialog is displayed when editing a file
already open in another (running) Nvim. Usually this behavior is
annoying and irrelevant:
- "Recover" and the other options ("Open readonly", "Quit", "Abort") are
  almost never wanted.
- swapfiles are less relevant for "multi-Nvim" since 'autoread' is
  enabled by default.
  - Even less relevant if user enables 'autowrite'.

Solution:
Define a default SwapExists handler which does the following:
1. If the swapfile is owned by a running Nvim process, automatically
   chooses "(E)dit anyway" (caveat: this creates a new, extra swapfile,
   which is mostly harmless and ignored except by `:recover` or `nvim -r`.
2. Shows a 1-line "ignoring swapfile..." message.
3. Users can disable the default SwapExists handler via `autocmd! nvim_swapfile`.
2023-10-04 06:31:25 -07:00
zeertzjq
08aea256c8
vim-patch:2dfc22908e43 (#25485)
runtime(doc): remove E1507 help tag, which is no longer used (vim/vim#13254)

2dfc22908e
2023-10-03 14:32:47 +08:00
zeertzjq
3af59a415c
fix(treesitter): make Visual hl work consistently with foldtext (#25484)
Problem:  Visual highlight is inconsistent on a folded line with
          treesitter foldtext.
Solution: Don't added Folded highlight as it is already in background.
2023-10-03 13:07:03 +08:00
zeertzjq
6851b265ba
fix(clipboard): don't pass --foreground to wl-copy (#25481)
Fix #25466
2023-10-03 11:24:33 +08:00
zeertzjq
1101cfeb34
vim-patch:9.0.1972: win32: missing '**' expansion test (#25476)
Problem:  win32: missing '**' expansion test (after v9.0.1947)
Solution: Add test for MS-Windows

win32: Add "**" test

Vim supports "**" on MS-Windows. However, it is not tested by
`Test_glob_extended_bash`.

Unlike Unix, it doesn't use 'shell' and doesn't support {,} expansion.
So, I added as a separate test.

related: vim/vim#13205
closes: vim/vim#13250

4a1ad55564

Co-authored-by: Ken Takata <kentkt@csc.jp>
2023-10-03 07:24:54 +08:00
zeertzjq
e0d669ffdb vim-patch:cd39b69b0200
runtime(doc): add missing error numbers in the help.  (vim/vim#13241)

closes: vim/vim#13240

cd39b69b02

Co-authored-by: Yegappan Lakshmanan <4298407+yegappan@users.noreply.github.com>
2023-10-03 06:26:54 +08:00
zeertzjq
19b49b063c vim-patch:20f48d5b2ddb
runtime(doc): mention how to disable folding in diff mode (vim/vim#13242)

20f48d5b2d

Co-authored-by: dundargoc <33953936+dundargoc@users.noreply.github.com>
2023-10-03 06:23:15 +08:00
zeertzjq
b003e7feca vim-patch:ba77bbb5c775
runtime(doc): fix typos.

* Fix typo in document (Related: vim/vim#12516)
* Fix E1363 duplication
* Fix one more typo.

ba77bbb5c7

Co-authored-by: h_east <h.east.727@gmail.com>
2023-10-03 06:21:37 +08:00
Maria José Solano
eb1f0e8fcc feat(lsp)!: replace snippet parser by lpeg grammar 2023-10-02 22:21:35 +02:00
Maria José Solano
f736b075d3 feat(lsp): snippet parsing using lpeg 2023-10-02 22:21:35 +02:00
Mathias Fußenegger
4a09c178a1
feat(lsp): fallback to code-action command on resolve failure (#25464)
The haskell-language-server supports resolve only for a subset of code
actions. For many code actions trying to resolve the `edit` property
results in an error, but the unresolved action already contains a
command that can be executed without issue.

The protocol specification is unfortunately a bit vague about this,
and what the haskell-language-server does seems to be valid.

Example:

    newtype Dummy = Dummy Int
    instance Num Dummy where

Triggering code actions on "Num Dummy" and choosing "Add placeholders
for all missing methods" resulted in:

    -32601: No plugin enabled for SMethod_CodeActionResolve, potentially available: explicit-fields, importLens, hlint, overloaded-record-dot

With this change it will insert the missing methods:

    instance Num Dummy where
      (+) = _
      (-) = _
      (*) = _
      negate = _
      abs = _
      signum = _
      fromInteger = _
2023-10-02 22:14:19 +02:00
Till Bungert
9ce1623837
feat(treesitter): add foldtext with treesitter highlighting (#25391) 2023-10-01 14:10:51 -05:00
zeertzjq
01c51a4913 feat(completion): support completing more string options 2023-10-01 20:00:23 +08:00
zeertzjq
f06af5e669 vim-patch:9.0.1958: cannot complete option values
Problem:  cannot complete option values
Solution: Add completion functions for several options

Add cmdline tab-completion for setting string options

Add tab-completion for setting string options on the cmdline using
`:set=` (along with `:set+=` and `:set-=`).

The existing tab completion for setting options currently only works
when nothing is typed yet, and it only fills in with the existing value,
e.g. when the user does `:set diffopt=<Tab>` it will be completed to
`set diffopt=internal,filler,closeoff` and nothing else. This isn't too
useful as a user usually wants auto-complete to suggest all the possible
values, such as 'iblank', or 'algorithm:patience'.

For set= and set+=, this adds a new optional callback function for each
option that can be invoked when doing completion. This allows for each
option to have control over how completion works. For example, in
'diffopt', it will suggest the default enumeration, but if `algorithm:`
is selected, it will further suggest different algorithm types like
'meyers' and 'patience'. When using set=, the existing option value will
be filled in as the first choice to preserve the existing behavior. When
using set+= this won't happen as it doesn't make sense.

For flag list options (e.g. 'mouse' and 'guioptions'), completion will
take into account existing typed values (and in the case of set+=, the
existing option value) to make sure it doesn't suggest duplicates.

For set-=, there is a new `ExpandSettingSubtract` function which will
handle flag list and comma-separated options smartly, by only suggesting
values that currently exist in the option.

Note that Vim has some existing code that adds special handling for
'filetype', 'syntax', and misc dir options like 'backupdir'. This change
preserves them as they already work, instead of converting to the new
callback API for each option.

closes: vim/vim#13182

900894b09a

Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
2023-10-01 20:00:23 +08:00
bfredl
9b3045103f
Merge pull request #25455 from bfredl/highlight_namespace_getters
feat(ui): allow to get the highlight namespace. closes #24390
2023-10-01 10:39:31 +02:00
Daniel Steinberg
2615ed879e feat(ui): allow to get the highlight namespace 2023-10-01 10:02:36 +02:00
zeertzjq
f6e72c3dfe vim-patch:9.0.1962: No support for writing extended attributes
Problem:  No support for writing extended attributes
Solution: Add extended attribute support for linux

It's been a long standing issue, that if you write a file with extended
attributes and backupcopy is set to no, the file will loose the extended
attributes.

So this patch adds support for retrieving the extended attributes and
copying it to the new file. It currently only works on linux, mainly
because I don't know the different APIs for other systems (BSD, MacOSX and
Solaris).  On linux, this should be supported since Kernel 2.4 or
something, so this should be pretty safe to use now.

Enable the extended attribute support with normal builds.

I also added it explicitly to the :version output as well as make it
able to check using `:echo has("xattr")`, to have users easily check
that this is available.

In contrast to the similar support for SELINUX and SMACK support (which
also internally uses extended attributes), I have made this a FEAT_XATTR
define, instead of the similar HAVE_XATTR.

Add a test and change CI to include relevant packages so that CI can
test that extended attributes are correctly written.

closes: vim/vim#306
closes: vim/vim#13203

e085dfda5d

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-30 22:09:55 +08:00
bfredl
578d634176
Merge pull request #25386 from glepnir/toggle_float
feat(float): support toggle show float window
2023-09-30 13:40:35 +02:00
glepnir
4200a0f167 feat(float): support toggle show float window 2023-09-30 18:30:23 +08:00
Dr. Matthew Swabey
54daf022ce
docs(term): use tic -x for better compatibility with old ncurses (#25421)
Use `tic -x` instead of `tic` to include any unknown capabilities in a modern `terminfo.src` as user-defined ones, instead of dropping them. Modern ncurses behavior with `tic -x` will not change.
2023-09-29 10:57:02 -05:00
Maria José Solano
9ed830a3ca
refactor(lsp): deprecate util methods (#25400) 2023-09-29 17:37:14 +02:00
zeertzjq
b917db062f
vim-patch:02902b547bdb (#25406)
runtime(doc): text-objects: document how escaped delimiters are handled

02902b547b

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-29 07:05:21 +08:00
zeertzjq
7ec20a4082
vim-patch:9.0.1950: Vim9: error codes spread out (#25405)
Problem:  Vim9: error codes spread out
Solution: group them together and reserve 100
          more for future use

Reserve 100 error codes for future enhancements to the Vim9 class
support

closes: vim/vim#13207

413f83990f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-29 06:52:02 +08:00
zeertzjq
92e40f8d18 vim-patch:9.0.1946: filename expansion using ** in bash may fail
Problem:  filename expansion using ** in bash may fail
Solution: Try to enable the globstar setting

Starting with bash 4.0 it supports extended globbing using the globstar
shell option. This makes matching recursively below a certain directory
using the ** pattern work as expected nowadays.  However, we need to
explicitly enable this using the 'shopt -s globstar' bash command.

So let's check the bash environment variable $BASH_VERSINFO (which is
supported since bash 3.0 and conditionally enable the globstar option,
if the major version is at least 4. For older bashs, this at least
shouldn't cause errors (unless one is using really ancient bash 2.X or
something).

closes: vim/vim#13002
closes: vim/vim#13144

9eb1ce5315

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-29 06:07:27 +08:00
dundargoc
1913041518
docs: Lua docstrings guidance #25345
Recommend adding a space after i.e. `--- @see`.

The "space" variant is common for the vast majority of docstring formats
such as doxygen, javadoc and typescript.
2023-09-27 21:57:22 -07:00
zeertzjq
86b7d8a9f5
vim-patch:5277cfaf8afe (#25397)
runtime(doc): mention mouse scrolling in scrollbind-quickadj (vim/vim#13190)

5277cfaf8a
2023-09-28 05:22:09 +08:00
Christian Clason
1783023da7 vim-patch:54f70cf0780a
runtime(swayconfig): Update syntax file (vim/vim#13192)

54f70cf078

Co-authored-by: Josef Litoš <54900518+JosefLitos@users.noreply.github.com>
2023-09-27 22:20:03 +02:00
Christian Clason
af1df3cb78 vim-patch:02774f99cebc
runtime(i3config): update i3config syntax (vim/vim#13191)

02774f99ce

Co-authored-by: Josef Litoš <54900518+JosefLitos@users.noreply.github.com>
2023-09-27 22:20:03 +02:00
Christian Clason
555f492ec6 vim-patch:347459423903
runtime(rmd) Update ftplugin and syntax files (vim/vim#13193)

ftplugin/rmd.vim:

  - Set 'commentstring' dynamically according to code region.

syntax/rmd.vim:

  - Include syntax highlighting of fenced languages dynamically.
  - Add conceal char for line break.

3474594239

Co-authored-by: Jakson Alves de Aquino <jalvesaq@gmail.com>
2023-09-27 22:20:03 +02:00
Rory Nesbitt
a66b0fdfaa
feat: NVIM_APPNAME supports relative paths #25233
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix #23056
fix #24966
2023-09-27 10:09:55 -07:00
Justin M. Keyes
de93489789 refactor(tutor): cleanup 2023-09-26 06:41:53 -07:00
Leonardo Mello
bc6fc0123d
fix(tutor): Tutor steps don't work on Windows #25251
Problem:
Some steps in :Tutor don't work on Windows.

Solution:
Add support for `{unix:...,win:...}` format and transform the Tutor contents
depending on the platform.
Fix https://github.com/neovim/neovim/issues/24166
2023-09-26 06:31:35 -07:00
bfredl
fe95037cdb
Merge pull request #25229 from glepnir/20323
fix(highlight): add force in nvim_set_hl
2023-09-26 14:20:10 +02:00
glepnir
f8ea49cfe1 fix(highlight): add force in nvim_set_hl 2023-09-26 19:41:23 +08:00
Maria José Solano
4db77017fb fix(meta): add nil return types to lpeg functions 2023-09-26 09:43:44 +02:00
Maria José Solano
5198a2555d fix(meta): cleanup lpeg operators 2023-09-26 09:43:44 +02:00
Christian Clason
ddc147da2f vim-patch:54e1f56cf2a5
runtime(sh): only invoke bash help in ftplugin if it has been detected to be bash (vim/vim#13171)

54e1f56cf2

Co-authored-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
2023-09-26 09:37:47 +02:00
ricardaxel
3387dc4a46
fix(runtime): add commentstring for D ftplugin (#25362)
Problem: No commentstring is set for D buffers after removing the
default C-style commentstring

Same solution than neovim#23039

Co-authored-by: Axel Ricard <axel.ricard@allegrodvt.com>
2023-09-26 06:13:58 +08:00
bfredl
c3d1d9445c refactor(options)!: graduate some more shortmess flags
A lot of updated places in the docs were already incorrect since long
since they did not reflect the default behaviour.

"[dos format]" could've been argued being better for discoverability
but that ship has already sailed as it is no longer displayed by default.
2023-09-25 18:23:15 +02:00
bfredl
ccd1a84a96
Merge pull request #25344 from gpanders/doc-shortmess
docs: remove "f" from default 'shortmess' value
2023-09-25 11:34:05 +02:00
Maria José Solano
db51548036
docs: do not use deprecated functions #25334 2023-09-24 21:39:59 -07:00
Gregory Anders
fdcb74fc4b docs: remove more references to shm-f 2023-09-24 19:40:00 -05:00
zeertzjq
2049e22f7f vim-patch:960822a11f70
runtime(doc): grammar fixes in doc (vim/vim#13164)

960822a11f

Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com>
2023-09-25 06:39:35 +08:00
zeertzjq
57b84f6d64 vim-patch:790f9a890cee
runtime(doc): Add a missing '<' to the help of strutf16len() (vim/vim#13168)

790f9a890c

Co-authored-by: a5ob7r <12132068+a5ob7r@users.noreply.github.com>
2023-09-25 06:38:38 +08:00
Maria José Solano
f9944a78bc feat(meta): add types for vim.lpeg 2023-09-24 22:10:10 +02:00
Bogdan Grigoruță
d1bc6fca71
feat(health): list attached buffers in LSP report #23561
Problem:
Users using `vim.lsp.start` directly (instead of nvim-lspconfig) need
more visibility for troubleshooting. For example, troubleshooting
unnecesary servers or servers that aren't attaching to expected buffers.

Solution:
Mention attached buffers in the `:checkhealth lsp` report.

Example:

    vim.lsp: Active Clients ~
    - clangd (id=1, root_dir=~/dev/neovim, attached_to=[7])
    - lua_ls (id=2, root_dir=~/dev/neovim, attached_to=[10])
2023-09-24 11:43:16 -07:00
Tom Blake
3bbb0aa399
fix: checkhealth warning even if init.lua exists #25306
Problem:
`:checkhealth nvim` warns about missing vimrc if `init.lua` exists but
`init.vim` does not.

Solution:
Check for any of: init.vim, init.lua, $MYVIMRC.
Fix #25291
2023-09-24 10:43:55 -07:00
Gregory Anders
6fb1e0d499 docs: remove "f" from default 'shortmess' value
The "f" flag was removed in f7da472257.
The value of the "f" flag is no longer listed in the 'shortmess'
description and it cannot be disabled, so having it in the default value
is pointless and confusing.
2023-09-24 09:09:18 -05:00
zeertzjq
61ecb3e16c
fix(provider/pythonx): import the correct module (#25342) 2023-09-24 22:04:29 +08:00
zeertzjq
ac1c23442f
test(old): don't set options to default before every test (#25335)
Oldtests clean up after themselves, and the options that need operators
to align with Vim all deny duplicates, so there is no need to set them
to default.

Also make the variable name that test_listchars.vim uses to align with
Vim more obvious.
2023-09-24 11:20:23 +08:00
tj-moody
046c9a83f7
fix(ui): always use stl/stlnc fillchars when drawing statusline (#25267) 2023-09-24 10:49:47 +08:00
Maria José Solano
bc0bf9d030 docs: fix type warnings 2023-09-23 23:46:45 +01:00
bfredl
f7da472257 refactor(options)!: graduate shortmess+=f flag
Not everything needs to be crazy overconfigurable.

Also fixes a warning in latest clang which didn't approve of
the funky math switch statement in  append_arg_number
2023-09-23 18:13:05 +02:00
Jongwook Choi
7bd6bd1ef7
fix(provider): cannot detect python3.12 #25316
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
2023-09-23 02:49:34 -07:00
zeertzjq
c68c121f50
Merge pull request #25286 from rktjmp/doc-vim-schedule-wrap
docs: add more context to vim.schedule_wrap
2023-09-23 07:08:03 +08:00
Maria José Solano
dae6770b76 fix(meta): include vim.json 2023-09-22 23:02:45 +01:00
Oliver Marriott
44f698bb1a docs: update vim.schedule param name and type
Per https://github.com/neovim/neovim/pull/25286#discussion_r1332861721
and https://github.com/neovim/neovim/pull/25286#discussion_r1334318352
2023-09-23 01:54:24 +10:00
L Lllvvuu
e353c869ce fix(languagetree): don't treat unparsed nodes as occupying full range
This is incorrect in the following scenario:
1. The language tree is Lua > Vim > Lua.
2. An edit simultaneously wipes out the `_regions` of all nodes, while
   taking the Vim injection off-screen.
3. The Vim injection is not re-parsed, so the child Lua `_regions` is
   still `nil`.
4. The child Lua is assumed, incorrectly, to occupy the whole document.
5. This causes the injections to be parsed again, resulting in Lua > Vim
   > Lua > Vim.
6. Now, by the same process, Vim ends up with its range assumed over the
   whole document. Now the parse is broken and results in broken
   highlighting and poor performance.

It should be fine to instead treat an unparsed node as occupying
nothing (i.e. effectively non-existent). Since, either:
- The parent was just parsed, hence defining `_regions`
- The parent was not just parsed, in which case this node doesn't need
  to be parsed either.

Also, the name `has_regions` is confusing; it seems to simply
mean the opposite of "root" or "full_document". However, this PR does
not touch it.
2023-09-22 12:51:51 +01:00
Oliver Marriott
f413597f44 docs: clarify vim.schedule_wrap behaviour
- Remove the usage of the term "defer" to avoid confusion with
  `vim.defer_fn`, which also calls `vim.schedule_wrap` internally.
- Explicitly state that `vim.schedule_wrap` returns a function in the
  text.
- Mention that arguments are passed along.
- Include a usage example.
- Rename param to `fn`.
2023-09-22 18:38:28 +10:00
zeertzjq
fcfc87cb77
docs: small improvements to compl-autocomplete example (#25299)
- Don't complete when there is pending input.
- Use vim.list_contains() instead of vim.tbl_contains().
2023-09-22 06:51:47 +08:00
Sergey Slipchenko
345bd91db2
fix(lsp): handle absence of a trailing newline #25194
Fixes #24339

rust-analyzer sends "Invalid offset" error in such cases. Some other
servers handle it specially.

LSP spec mentions that "A range is comparable to a selection in an
editor". Most editors don't handle trailing newlines the same way
Neovim/Vim does, it's clearly visible if it's present or not. With that
in mind it's understandable why sending end position as simply the start
of the line after the last one is considered invalid in such cases.
2023-09-21 03:06:40 -07:00
Jaehwang Jung
8bd6f7c20b
fix(lsp): clear codelens on LspDetach (#24903)
Also fix incorrect parameters in on_detach callback.
2023-09-21 09:56:15 +02:00
zeertzjq
48410e8486
vim-patch:a7aba6ca5033 (#25285)
runtime(doc): format jumplist examples more consistently (vim/vim#13137)

a7aba6ca50
2023-09-21 15:06:06 +08:00
zeertzjq
f094db0e5c
vim-patch:9.0.1921: not possible to use the jumplist like a stack (#25278)
Problem:  not possible to use the jumplist like a stack
Solution: Add the 'jumpoptions' setting to make the jumplist
          a stack.

Add an option for using jumplist like tag stack

related: vim/vim#7738
closes: vim/vim#13134

ported from NeoVim:

- https://neovim.io/doc/user/motion.html#jumplist-stack
- neovim/neovim@39094b3
- https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior

Based on the feedback in the previous PR, it looks like many people like
this option.

87018255e3

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Co-authored-by: butwerenotthereyet <58348703+butwerenotthereyet@users.noreply.github.com>
2023-09-21 07:37:03 +08:00
Christian Clason
473d0aa3e6 vim-patch:9.0.1918
patch 9.0.1918: No filetype detection for Authzed filetypes

Problem:  No filetype detection for Authzed filetypes
Solution: Detect the *.zed file extension as authzed filetype

closes: vim/vim#13129

5790a54166

Co-authored-by: Matt Polzin <mpolzin@workwithopal.com>
2023-09-21 00:32:35 +02:00
Lewis Russell
877d04d0fb feat(lua): add vim.func._memoize
Memoizes a function, using a custom function to hash the arguments.

Private for now until:

- There are other places in the codebase that could benefit from this
  (e.g. LSP), but might require other changes to accommodate.
- Invalidation of the cache needs to be controllable. Using weak tables
  is an acceptable invalidation policy, but it shouldn't be the only
  one.
- I don't think the story around `hash_fn` is completely thought out. We
  may be able to have a good default hash_fn by hashing each argument,
  so basically a better 'concat'.
2023-09-20 13:42:41 +01:00
Justin M. Keyes
1b55f51d0d
docs: misc #24561
fix #24699
fix #25253
2023-09-20 04:15:23 -07:00
Eduardo Rittner Coelho
b6ef938c66
docs: document $XDG environment variables #25227 2023-09-20 02:04:30 -07:00
zeertzjq
c4f4c7a356
vim-patch:9.0.1915: r_CTRL-C works differently in visual mode (#25248)
Problem:  r_CTRL-C works differently in visual mode
Solution: Make r_CTRL-C behave consistent in visual mode
          in terminal and Windows GUI

in visual mode, r CTRL-C behaves strange in Unix like environments. It
seems to end visual mode, but still is waiting for few more chars,
however it never seems to replace it by any characters and eventually
just returns back into normal mode.

In contrast in Windows GUI mode, r_CTRL-C replaces in the selected area
all characters by a literal CTRL-C.

Not sure why it behaves like this. It seems in the Windows GUI, got_int
is not set and therefore behaves as if any other normal character has
been pressed.

So remove the special casing of what happens when got_int is set and
make it always behave like in Windows GUI mode. Add a test to verify it
always behaves like replacing in the selected area each selected
character by a literal CTRL-C.

closes: vim/vim#13091
closes: vim/vim#13112

476733f3d0

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-20 06:37:29 +08:00
Maria José Solano
5a363ccac8 fix(lsp)!: deprecate trim_empty_lines 2023-09-19 14:47:37 +01:00
Maria José Solano
cfd4a9dfaf feat(lsp): use treesitter for stylize markdown 2023-09-19 14:47:37 +01:00
bfredl
1db45a9c1f
Merge pull request #25214 from bfredl/glyphcache
refactor(grid): change schar_T representation to be more compact
2023-09-19 12:32:41 +02:00
bfredl
2de5cddeb1
Merge pull request #25148 from glepnir/fixed_opt
fix(float): add fixed option
2023-09-19 11:49:59 +02:00
bfredl
8da986ea87 refactor(grid): change schar_T representation to be more compact
Previously, a screen cell would occupy 28+4=32 bytes per cell
as we always made space for up to MAX_MCO+1 codepoints in a cell.

As an example, even a pretty modest 50*80 screen would consume

50*80*2*32 = 256000, i e a quarter megabyte

With the factor of two due to the TUI side buffer, and even more when
using msg_grid and/or ext_multigrid.

This instead stores a 4-byte union of either:
- a valid UTF-8 sequence up to 4 bytes
- an escape char which is invalid UTF-8 (0xFF) plus a 24-bit index to a
  glyph cache

This avoids allocating space for huge composed glyphs _upfront_, while
still keeping rendering such glyphs reasonably fast (1 hash table lookup
+ one plain index lookup). If the same large glyphs are using repeatedly
on the screen, this is still a net reduction of memory/cache
consumption. The only case which really gets worse is if you blast
the screen full with crazy emojis and zalgo text and even this case
only leads to 4 extra bytes per char.

When only <= 4-byte glyphs are used, plus the 4-byte attribute code,
i e 8 bytes in total there is a factor of four reduction of memory use.
Memory which will be quite hot in cache as the screen buffer is scanned
over in win_line() buffer text drawing

A slight complication is that the representation depends on host byte
order. I've tested this manually by compling and running this
in qemu-s390x and it works fine. We might add a qemu based solution
to CI at some point.
2023-09-19 11:25:31 +02:00
zeertzjq
6405fa4b11
vim-patch:346ac1429c5a (#25239)
runtime(doc): add help tag describing object-selection

closes: vim/vim#13114

346ac1429c

Co-authored-by: Christian Brabandt <cb@256bit.org>
2023-09-19 07:07:24 +08:00
glepnir
fd08fd3de3 fix(float): add fixd option 2023-09-18 18:21:14 +08:00
Christian Clason
9de5cb0b32 vim-patch:d8b86c937a41
runtime(netrw): fix filetype detection for remote editing files

closes: vim/vim#12990
closes: 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>
2023-09-17 22:52:56 +02:00
Christian Clason
1b74d2bf0a vim-patch:e30d8e4ce01d
runtime(kotlin): Add Kotlin runtime files (vim/vim#13110)

Closes udalov/kotlin-vimvim/vim#39

e30d8e4ce0

Co-authored-by: dkearns <dougkearns@gmail.com>
2023-09-17 22:52:56 +02:00
Christian Clason
ed45aa835c vim-patch:9.0.1907: No support for liquidsoap filetypes
Problem:  No support for liquidsoap filetypes
Solution: Add liquidsoap filetype detection code

closes: vim/vim#13111

6b5efcdd8e

Co-authored-by: Romain Beauxis <toots@rastageeks.org>
2023-09-17 22:26:10 +02:00
Jaehwang Jung
71d9b7d15c fix(treesitter): _trees may not be list-like
Problem:
With incremental injection parsing, injected languages' parsers parse
only the relevant regions and stores the result in _trees with the index
of the corresponding region. Therefore, there can be holes in _trees.

Solution:
* Use generic table functions where appropriate.
* Fix type annotations and docs.
2023-09-17 19:52:35 +01:00
zeertzjq
71530cc972
feat(folds): support virtual text format for 'foldtext' (#25209)
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-09-17 20:29:18 +08:00
dundargoc
677df72e40 docs: remove joke from pronounce
N-Jim does not sounds like "Ninja", and the joke doesn't really land.
2023-09-17 12:33:01 +02:00
zeertzjq
aac85b8d6b
docs(tutor): clarify the meaning of ✗ and ✓ (#25204)
Also reformat tutor.tutor.json to use 2-space indent while at it.
2023-09-17 08:48:13 +08:00
Phelipe Teles
4ab9c5fa46
fix(lua): not using global value in vim.opt_global (#25196) 2023-09-17 06:35:12 +08:00
Maria José Solano
28f54a7878
feat(treesitter): add lang parameter to the query editor (#25181) 2023-09-16 19:05:59 +02:00
Jaehwang Jung
7e5ce42977 fix(treesitter): properly combine injection.combined regions
Problem:
It doesn't make much sense to flatten each region (= list of ranges).
This coincidentally worked for region with a single range.

Solution:
Custom function for combining regions.
2023-09-16 17:02:26 +01:00
Lewis Russell
f40a109716 fix(treesitter): fix trim predicate 2023-09-16 14:24:55 +01:00
Lewis Russell
b3342171d5 fix(typing): vim.fn.execute 2023-09-16 14:24:24 +01:00
L Lllvvuu
07080f67fe perf(treesitter): do not scan past given line for predicate match
Problem
---
If a highlighter query returns a significant number of predicate
non-matches, the highlighter will scan well past the end of the window.

Solution
---
In the iterator returned from `iter_captures`, accept an optional
parameter `end_line`. If no parameter provided, the behavior is
unchanged, hence this is a non-invasive tweak.

Fixes: #25113 nvim-treesitter/nvim-treesitter#5057
2023-09-16 13:52:42 +01:00
L Lllvvuu
908843df61 fix(languagetree): apply resolve_lang to metadata['injection.language']
`resolve_lang` is applied to `@injection.language` when it's supplied as a
capture:

f5953edbac/runtime/lua/vim/treesitter/languagetree.lua (L766-L768)

If we want to support `metadata['injection.language']` (as per #22518 and
[tree-sitter upstream](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection))
then the behavior should be consistent.

Fixes: nvim-treesitter/nvim-treesitter#4918
2023-09-16 11:12:06 +01:00