Commit Graph

21502 Commits

Author SHA1 Message Date
zeertzjq
0c8e48c78d
chore(editorconfig): remove "charset" (#18541)
Hardcoding a charset causes trouble when porting Vim patches.
I previously tried to unset "charset" for certain file extensions, but
vim-patch.sh can generate more files, and automatically detecting file
encoding is more correct anyway.
2022-05-12 23:48:42 +08:00
zeertzjq
a200ce0d85
vim-patch:8.2.4941: '[ and '] marks may be wrong after undo (#18539)
Problem:    '[ and '] marks may be wrong after undo.
Solution:   Adjust the '[ and '] marks if needed. (closes vim/vim#10407, closes vim/vim#1281)
82444cefa3
2022-05-12 23:38:26 +08:00
Marco Hinz
8fba428bc6
fix(cmd): make :-tabmove work with modifiers (#18447)
`:tabmove` takes either an argument (`:tabmove -`) or an address (`:-tabmove`).

The code assumed that `:tabmove` is the first command on the cmdline, but that
is not the case when using additional modifiers like `:silent`.

Make the addr parsing more robust by searching the command first, then going
back to check for a potential address `-`.
2022-05-12 16:43:20 +02:00
Ivan
78a1e6bc00 feat(defaults): session data in $XDG_STATE_HOME #15583
See: 4f2884e16d

- Move session persistent data to $XDG_STATE_HOME Change 'directory',
  'backupdir', 'undodir', 'viewdir' and 'shadafile' default location to
  $XDG_STATE_HOME/nvim.
- Move logs to $XDG_STATE_HOME, too.
- Add stdpath('log') support.

Fixes: #14805
2022-05-12 07:13:45 -07:00
dundargoc
a1b663cce8
build(lua2dox): add parenthesis around parameter types in documentation (#18532)
This will check if the string after the variable in a @param is either
"number", "string", "table", "boolean" and "function" and if so add a
parenthesis around it. This will help separate the variable type with
the following text. Had all our functions been annotated with emmylua
then a more robust solution might have been preferable (such as always
assuming the third string is parameter type without making any checks).
I believe however this is a clear improvement over the current situation
and will suffice for now.
2022-05-12 08:02:46 -06:00
Famiu Haque
2bbd588e73
feat(lua): vim.cmd() with kwargs acts like nvim_cmd() #18523 2022-05-12 06:34:38 -07:00
Clément Bœsch
963cfa7020
fix(terminal): invalid pointer comparison #18453
At the moment of comparison, the pointer save_curwin can be invalid (as
suggested by the comment) because it has been free'd. Worst, the new
curwin could have been re-allocated to that same pointer, altering the
execution flow unpredictably.

While there are many other potential similar cases to fix in the
codebase, the presented scenario is not hypothetical and does happen in
practice (while spawning new windows from fzf for instance).

There are numerous other instances of curwin comparisons in the
codebase, and they may need further investigation.

closes #16941
2022-05-12 05:53:08 -07:00
zeertzjq
3a91adabda
refactor: rename keymap.{c,h} to keycodes.{c,h} (#18535)
Most code in keymap.h is for keycode definitions, while most code in
keymap.c is for the parsing and conversion of keycodes.

The name "keymap" may also make people think these two files are for
mappings, while in fact keycodes are used even when no mappings are
involved, so "keycodes" should be a better file name than "keymap".
2022-05-12 20:19:29 +08:00
kylo252
a2d4b862f1
ci(bsd): conditional runs for faster builds #18439
(undocumented) sourcehut feature for conditionally running consequent tasks.

ref:
https://lists.sr.ht/~sircmpwn/sr.ht-discuss/%3C3cd90a91b7ce113bb3c5f07898c77543%40hacktivista.com%3E
https://git.sr.ht/~sircmpwn/builds.sr.ht/tree/master/item/worker/tasks.go#L196-198
2022-05-11 18:26:07 -07:00
Sean Dewar
c24b442e31
fix(runtime/genvimvim): omit s[ubstitute] from vimCommand #18480
It's special cased by the vimSubst syntax group, and isn't present in Vim's
vimCommand group.

For example, this fixes `call s:Foo()` highlighting `:` as Error in Nvim, as the
`s` is parsed as vimCommand rather than as vimUserFunc since
`contains=vimCommand` was added to vimUserFunc (and vimFunc) in a rt update.

Interestingly, `g:`, `l:`, etc. have the same issues due to :global, :list, etc.
Vim also has that problem, so it should ideally be fixed upstream.

We could also omit g[lobal] from vimCommand and rely on vimGlobal instead, but
it doesn't work in some cases, like when there's a `:` before the command. Also,
Vim matches only `g` in vimCommand for some reason, which doesn't produce any
highlight for `:global/foo/bar` (with Nvim you at least get some highlights on
the `global` bit despite the leading `:`).

Also, remove special handling of :py3 in syntax/vim.vim, as the generator seems
to have no problems finding it.
2022-05-11 17:08:25 -07:00
Andrey Mishchenko
60b1e314ed
docs: nvim_buf_[get|set]_[text|lines] (#18404)
- Use consistent formatting for args docs.
- Clarify inclusivity/exclusivity in `nvim_buf_[get|set]_text`.
2022-05-11 17:05:56 -07:00
Andrey Mishchenko
7900a8b713
docs(api): how to check if window is floating #18503 2022-05-11 16:49:19 -07:00
Famiu Haque
cf68f0a512
fix(api): make nvim_cmd work correctly with empty arguments list (#18527)
Closes #18526.
2022-05-11 10:51:53 -06:00
adrian5
a6f4cfdefa
docs(api): improve shared lua functions docs (#17933) 2022-05-11 10:23:46 -06:00
zeertzjq
e36e0f7b2f
vim-patch:8.2.4939: matchfuzzypos() with "matchseq" does not have all positions (#18525)
Problem:    matchfuzzypos() with "matchseq" does not have all positions.
Solution:   Also add a position for white space. (closes vim/vim#10404)
9af2bc0751
2022-05-11 21:51:31 +08:00
zeertzjq
b13089c956
Merge pull request #18522 from zeertzjq/vim-8.2.4901
vim-patch:8.2.{4901,4938}: NULL pointer access when using invalid pattern
2022-05-11 19:47:05 +08:00
zeertzjq
6f52bc5dee vim-patch:8.2.4938: crash when matching buffer with invalid pattern
Problem:    Crash when matching buffer with invalid pattern.
Solution:   Check for NULL regprog.
a59f2dfd0c
2022-05-11 19:13:07 +08:00
zeertzjq
0019886a84 vim-patch:8.2.4901: NULL pointer access when using invalid pattern
Problem:    NULL pointer access when using invalid pattern.
Solution:   Check for failed regexp program.
8e4b76da1d
2022-05-11 19:09:21 +08:00
bfredl
96a125b207
Merge pull request #18366 from famiu/feat/api/nvim_cmd
feat(api): add `nvim_cmd`
2022-05-11 10:39:02 +02:00
Christian Clason
3a5abcd649
chore: git-blame-ignore stylua format PR (#18516)
add aefdc6783c
to .git-blame-ignore-revs
2022-05-11 09:31:58 +02:00
Famiu Haque
dfcc584665 feat(api): add nvim_cmd
Adds the API function `nvim_cmd` which allows executing an Ex-command through a Dictionary which can have the same values as the return value of `nvim_parse_cmd()`. This makes it much easier to do things like passing arguments with a space to commands that otherwise may not allow it, or to make commands interpret certain characters literally when they otherwise would not.
2022-05-11 13:12:16 +06:00
Christian Clason
39afa64eed
build(deps): bump Luv to HEAD - c51e7052e (#18510) 2022-05-11 08:58:06 +02:00
Christian Clason
cb7ab98925
Merge pull request #18487 from clason/stylua
CI: format and lint runtime with Stylua
2022-05-11 08:54:24 +02:00
Christian Clason
e50b1fe60d
vim-patch:921bde888046 (#18511)
Update runtime files, translations
921bde8880

skip: translations
skip: builtin.txt (requires 8.2.4861)
2022-05-10 10:55:33 +02:00
zeertzjq
5359be7893
Merge pull request #18509 from zeertzjq/vim-8.2.4929
vim-patch:8.2.4929: off-by-one error in in statusline item
2022-05-10 08:54:37 +08:00
zeertzjq
65df08aade test: convert two statusline oldtests to Lua screen tests 2022-05-10 08:15:46 +08:00
zeertzjq
406c2e35b3 vim-patch:8.2.4929: off-by-one error in in statusline item
Problem:    Off-by-one error in in statusline item.
Solution:   Subtrace one less. (closes vim/vim#10394, closes vim/vim#5599)
57ff52677b
2022-05-10 07:59:43 +08:00
zeertzjq
9aa5647e68
vim-patch:8.2.4911: the mode #defines are not clearly named (#18499)
Problem:    The mode #defines are not clearly named.
Solution:   Prepend MODE_.  Renumber them to put the mapped modes first.
249591057b

A hunk from the patch depends on patch 8.2.4861, which hasn't been
ported yet, but that should be easy to notice.
2022-05-10 07:58:58 +08:00
Fredrik Ekre
c55867b46d
docs(lsp): fix description of only in vim.lsp.buf.code_action() (#18492) 2022-05-09 18:08:04 +02:00
Christian Clason
aefdc6783c chore: format runtime with stylua 2022-05-09 16:31:55 +02:00
Christian Clason
676e9e9334 ci: lint runtime with stylua 2022-05-09 16:31:55 +02:00
bfredl
77863b8e96 feat(keyset): allow hash conflicts 2022-05-09 19:53:47 +06:00
zeertzjq
8658e82357
vim-patch:8.2.4925: trailing backslash may cause reading past end of line (#18493)
Problem:    Trailing backslash may cause reading past end of line.
Solution:   Check for NUL after backslash.
53a70289c2

N/A patches for version.c:

vim-patch:8.2.4926: #ifdef for crypt feature around too many lines

Problem:    #ifdef for crypt feature around too many lines.
Solution:   Move code outside of #ifdef. (closes vim/vim#10388)
51f0bc31d3
2022-05-09 21:10:53 +08:00
zeertzjq
f0135d9cd9
Merge pull request #18491 from zeertzjq/vim-8.2.4924
vim-patch:8.2.4924: maparg() may return a string that cannot be reused
2022-05-09 19:44:31 +08:00
zeertzjq
db506d991d vim-patch:8.2.4924: maparg() may return a string that cannot be reused
Problem:    maparg() may return a string that cannot be reused.
Solution:   use msg_outtrans_special() instead of str2special().
            (closes vim/vim#10384)
0519ce0039
2022-05-09 19:19:21 +08:00
zeertzjq
41ce7b07e2
Merge pull request #18490 from zeertzjq/vim-8.2.4918
vim-patch:8.2.{4918,4923}: conceal character from matchadd() displayed too many times
2022-05-09 18:39:32 +08:00
zeertzjq
79929cf44d vim-patch:8.2.4923: test checks for terminal feature unnecessarily
Problem:    Test checks for terminal feature unnecessarily.
Solution:   Remove CheckRunVimInTerminal. (closes vim/vim#10383)
194843028e
2022-05-09 18:07:09 +08:00
zeertzjq
a56a43614c vim-patch:8.2.4918: conceal character from matchadd() displayed too many times
Problem:    Conceal character from matchadd() displayed too many times.
Solution:   Check the syntax flag. (closes vim/vim#10381, closes vim/vim#7268)
9830db6305
2022-05-09 18:06:55 +08:00
zeertzjq
5382ed8028
Merge pull request #18485 from zeertzjq/vim-8.2.4915
vim-patch:8.2.{4916,4922}: mouse in Insert mode test fails
2022-05-09 17:42:06 +08:00
zeertzjq
84c031fade vim-patch:8.2.4922: mouse test fails on MS-Windows
Problem:    Mouse test fails on MS-Windows.
Solution:   Set 'mousemodel' to "extend".
b370771bff
2022-05-09 17:16:22 +08:00
zeertzjq
a501127899 vim-patch:8.2.4916: mouse in Insert mode test fails
Problem:    Mouse in Insert mode test fails.
Solution:   Fix the text and check relevant positions.
8e8dc9b323

Use nvim_input_mouse() to set mouse position, and discard mouse event
using getchar().
2022-05-09 17:16:22 +08:00
bfredl
dfeb5b47bc
Merge pull request #18466 from dundargoc/refactor/remove-char_u
refactor: replace char_u variables and functions with char
2022-05-09 10:29:51 +02:00
Dundar Goc
e31b32a293 refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
2022-05-09 10:03:29 +02:00
Shougo
dbdd58e548
feat: cmdline funcs (#18284)
vim-patch:8.2.4903: cannot get the current cmdline completion type and position

Problem:    Cannot get the current cmdline completion type and position.
Solution:   Add getcmdcompltype() and getcmdscreenpos(). (Shougo Matsushita,
            closes vim/vim#10344)
79d599b877

vim-patch:8.2.4910: imperfect coding

Problem:    Imperfect coding.
Solution:   Make code nicer.
9ff7d717aa
2022-05-09 12:52:31 +08:00
bfredl
f6be28c61a
Merge pull request #18478 from bfredl/gridfile
refactor(grid): move out grid_* functions from screen.c
2022-05-09 00:44:33 +02:00
Gregory Anders
6cfb1d4c28
fix(lsp): detach spawned LSP server processes (#18477)
LSP servers should be daemonized (detached) so that they run in a
separate process group from Neovim's. Among other things, this ensures
the process does not inherit Neovim's TTY (#18475).

Make this configurable so that clients can explicitly opt-out of
detaching from Nvim.
2022-05-08 13:00:30 -06:00
bfredl
df41d884a7 refactor(grid): move out grid_* functions from screen.c
Also normalize some types. use "size_t" for unsigned array offsets.
Fix -Wconversion issues missed as screen.c is missing this check.
2022-05-08 13:22:09 +02:00
Sean Dewar
0d3f17a6c3
vim-patch:partial:d899e5112079 (#18474)
Update runtime files
d899e51120

- Skip vimhelp.vim stuff (syntax/help.vim, syntax.txt; v8.2.4891).
- Skip :let heredoc eval stuff (eval.txt; v8.2.4770).
- Skip uk.cp1251.po.
- Skip `*hl-CurSearch*` change (syntax.txt):
  - Vim's CurSearch works differently (Nvim's uses current cursor pos).
    Dunno know how applicable the redrawing comment is to Nvim...
  - Might be preferred to move it under `*hl-Search*` like Vim?
2022-05-08 10:15:36 +01:00
zeertzjq
1b1cc4d864
vim-patch:8.2.4908: no text formatting for // comment after a statement (#18472)
Problem:    No text formatting for // comment after a statement.
Solution:   format a comment when the 'c' flag is in 'formatoptions'.
48a8a83303
2022-05-08 07:51:12 +08:00
Christian Clason
0a00792332
vim-patch:8.2.4907: some users do not want a line comment always inserted (#18463)
Problem:    Some users do not want a line comment always inserted.
Solution:   Add the '/' flag to 'formatoptions' to not repeat the comment
            leader after a statement when using "o".
2bf875f881
2022-05-07 16:49:36 +02:00