Commit Graph

3118 Commits

Author SHA1 Message Date
Justin M. Keyes
09b6a68c37
Merge #21428 docs: naming conventions, guidelines 2023-02-22 10:40:01 -05:00
Justin M. Keyes
6752f1005d docs: naming conventions, guidelines
close #21063
2023-02-22 16:23:49 +01:00
Luuk van Baal
0b36145c69 docs: mention getmousepos() for click execute function label
close #18741
close #11312
2023-02-22 16:23:49 +01:00
Justin M. Keyes
b496605fea docs: vim_diff.txt 2023-02-22 16:23:49 +01:00
Gregory Anders
675826da63
refactor(treesitter): Add vim.treesitter.get_node() (#22360)
This function replaces both vim.treesitter.get_node_at_pos() and
vim.treesitter.get_node_at_cursor(). These two functions are similar
enough that they don't need separate interfaces. Even worse,
get_node_at_pos() returns a TSNode while get_node_at_cursor() returns a
string, so the two functions behave slightly differently.

vim.treesitter.get_node() combines these two into a more streamlined
interface. With no arguments, it returns the node under the cursor in
the current buffer. Optionally, it can accept a buffer number or a
position to get the node at a given position in a given buffer.
2023-02-22 08:01:08 -07:00
Lewis Russell
8714a4009c
feat(treesitter): add filetype -> lang API
Problem:

  vim.treesitter does not know how to map a specific filetype to a parser.

  This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang.

Solution:

  Add an API to enable this:

  - Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language().
    - Optional arguments are now passed via an opts table.
    - Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs.
    - Deprecated vim.treesitter.language.require_language().
  - Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype.
  - Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser.
2023-02-21 17:09:18 +00:00
zeertzjq
344a1ee8e6
docs: fix typos (#22353) 2023-02-22 00:07:26 +08:00
zeertzjq
ee26b227e1
vim-patch:partial:938ae280c79b (#22356)
Update runtime files.

938ae280c7

Partially skip autocmd.txt: needs patch 8.2.5011.
Partially skip builtin.txt: needs patch 9.0.0411.
Partially skip eval.txt: needs patch 8.2.3783.
Cherry-pick :map-meta-keys from patch 9.0.1276.

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-21 23:50:29 +08:00
zeertzjq
f1816f9ee2
refactor(main.c): remove unreachable use_builtin_ui conditions (#22338)
When use_builtin_ui is true, Nvim will exit before line 385 is reached.
2023-02-20 15:13:55 +08:00
dundargoc
b62c0c8d9c
docs: fix typos (#21961)
Co-authored-by: Ben Morgan <cassava@iexu.de>
2023-02-20 15:12:59 +08:00
Jonas Strittmatter
bcae4af374
docs: remove mentions of 'balloonexpr' #22049
'balloonexpr' option was removed in Nvim.
2023-02-16 06:54:25 -08:00
Ghjuvan Lacambre
d34c64e342
feat: $NVIM_APPNAME #22128
This commit implements the ability to control all of the XDG paths
Neovim should use. This is done by setting an environment variable named
NVIM_APPNAME. For example, setting $NVIM_APPNAME makes Neovim look for
its configuration directory in $XDG_CONFIG_HOME/$NVIM_APPNAME instead of
$XDG_CONFIG_HOME/nvim.

If NVIM_APPNAME is not set or is an empty string, "nvim" will be used as
default.

The usecase for this feature is to enable an easy way to switch from
configuration to configuration. One might argue that the various $XDG
environment variables can already be used for this usecase. However,
setting $XDG environment variables also affects tools spawned by Neovim.
For example, while setting $XDG_CONFIG_HOME will enable Neovim to use a
different configuration directory, it will also prevent Git from finding
its "default" configuration.

Closes https://github.com/neovim/neovim/issues/21691
2023-02-16 04:15:02 -08:00
Lewis Russell
a289e82142
fix(treesitter): make params optional 2023-02-15 12:26:07 +00:00
zeertzjq
374955bcc5
vim-patch:9.0.1300: 'statusline' only supports one "%=" item (#22218)
Problem:    'statusline' only supports one "%=" item.
Solution:   Add support for multiple "%=" items. (TJ DeVries, Yegappan
            Lakshmanan, closes vim/vim#11970, closes vim/vim#11965)

3ec78f973f

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-02-11 20:00:31 +08:00
zeertzjq
7d58de11f4
fix(rpc)!: preseve files when stdio channel is closed (#22137)
BREAKING CHANGE: Unsaved changes are now preserved rather than discarded
when stdio channel is closed.
2023-02-11 18:25:01 +08:00
Sizhe Zhao
165b07b269
docs: reword news.txt to ensure a consistent style (#22215) 2023-02-11 10:34:20 +01:00
Christian Clason
2af31fc50a
Merge pull request #22186 from clason/maintain
* docs(maintain): add note on updating `luvref.txt`
* docs(luvref): update version info
2023-02-09 13:15:29 +01:00
Christian Clason
1aa128b0ea docs(luvref): update version info 2023-02-09 11:54:37 +01:00
bfredl
7404f481ba
Merge pull request #22172 from bfredl/cells
perf(ui): mitigate redraw latency regression from TUI refactor
2023-02-08 18:36:36 +01:00
bfredl
625e990976 refactor(ui): cleanup 'redrawdebug', introduce "flush" mode 2023-02-08 18:02:55 +01:00
Christian Clason
d0008bd626 docs(luvref): update to version bump 2023-02-08 11:28:32 +01:00
Christian Clason
e1f03c481a
feat(spell): also source spell/LANG.lua when setting spelllang (#22111)
Problem: only Vimscript files are sourced when setting spelling language
Solution: also source Lua files after sourcing Vimscript files

Closes #22110
2023-02-06 10:01:38 +01:00
figsoda
e1d5ad1cb8 feat(treesitter): add metadata option for get_node_text 2023-02-04 21:15:03 -05:00
figsoda
bb8845340b feat(treesitter): allow capture text to be transformed
Co-authored-by: Lewis Russell <lewis6991@gmail.com>
2023-02-04 21:04:45 -05:00
Lewis Russell
9a5678463c
fix(treesitter): fix most diagnostics 2023-02-04 14:58:38 +00:00
Christian Clason
144279ef30
vim-patch:be4e01637e71 (#22103)
Update runtime files.

be4e01637e

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-02-03 09:18:18 +01:00
Thayne McCombs
cb97d5425a docs: clarify "pipe" mode for sockconnect
Make it more clear that on unix the "pipe" mode of sockconnect uses unix
local domain sockets, not named pipes (FIFOs) which are not currently
supported.

See discussion in #22080.

Signed-off-by: Thayne McCombs
2023-02-02 01:00:17 -07:00
bfredl
8376486e8f
Merge pull request #17537 from bfredl/neolua
refactor(tests): run unittests using main nvim binary - delete separate nvim-test build
2023-01-31 19:58:33 +01:00
bfredl
d6d6ab3f8e feat(lua): low-level interpreter mode (nvim -ll) 2023-01-31 13:53:22 +01:00
Christian Clason
c032e83b22 fix(treesitter): validate language name
Problem: Some injections (like markdown) allow specifying arbitrary
language names for code blocks, which may be lead to errors when
looking for a corresponding parser in runtime path.

Solution: Validate that the language name only contains alphanumeric
characters and `_` (e.g., for `c_sharp`) and error otherwise.
2023-01-28 11:28:52 +01:00
Lewis Russell
aec4b476c5
docs(api): tweak data arg for nvim_create_autocmd (#22008)
Fixes #21964
2023-01-27 11:24:20 +00:00
zeertzjq
e02df23b4e
docs: clarify :runtime behavior without [where] again (#22003)
The behavior changed again after #15867, change the docs to describe
latest behavior.
2023-01-26 19:35:06 +08:00
zeertzjq
f03f6263bb vim-patch:9.0.1238: :runtime completion can be further improved
Problem:    :runtime completion can be further improved.
Solution:   Also complete the {where} argument values and adjust the
            completion for that. (closes vim/vim#11874)

5c8771bc5a
2023-01-26 11:55:34 +08:00
zeertzjq
6320c91c50 vim-patch:9.0.1231: completion of :runtime does not handle {where} argument
Problem:    Completion of :runtime does not handle {where} argument.
Solution:   Parse the {where} argument. (closes vim/vim#11863)

3770f4c9cd
2023-01-26 11:55:34 +08:00
C.D. MacEachern
314d3ce1eb
docs(vim.fs): normalize Windows example was incorrect (#21966) 2023-01-25 06:45:30 +08:00
Lewis Russell
9166116c67
doc(lsp): format arguments to start_client() (#21980)
docs(lsp): format arguments to start_client()
2023-01-24 18:04:15 +00:00
Paul "LeoNerd" Evans
f3039ce531 feat(highlight): define the concept of altfont as a (c)term rendering attribute 2023-01-24 11:27:50 +00:00
Lewis Russell
f08051c2e6
feat!: make iconv a non-optional dep 2023-01-23 16:33:45 +00:00
Arnout Engelen
cb757f2663
build: make generated source files reproducible #21586
Problem:
Build is not reproducible, because generated source files (.c/.h/) are not
deterministic, mostly because Lua pairs() is unordered by design (for security).

https://github.com/LuaJIT/LuaJIT/issues/626#issuecomment-707005671
https://www.lua.org/manual/5.1/manual.html#pdf-next
> The order in which the indices are enumerated is not specified [...]
>
>> The hardening of the VM deliberately randomizes string hashes. This in
>> turn randomizes the iteration order of tables with string keys.

Solution:
- Update the code generation scripts to be deterministic.
    - That is only a partial solution: the exported function
      (funcs_metadata.generated.h) and ui event
      (ui_events_metadata.generated.h) metadata have some mpack'ed
      tables, which are not serialized deterministically.
    - As a workaround, introduce `PRG_GEN_LUA` cmake setting, so you can
      inject a modified build of luajit (with LUAJIT_SECURITY_PRN=0)
      that preserves table order.
    - Longer-term we should change the mpack'ed data structure so it no
      longer uses tables keyed by strings.

Closes #20124

Co-Authored-By: dundargoc <gocdundar@gmail.com>
Co-Authored-By: Arnout Engelen <arnout@bzzt.net>
2023-01-23 01:26:46 -08:00
kishii
7ef5e363d3
feat(lsp): add triggerKind option for vim.lsp.buf.code_action (#21905) 2023-01-21 08:22:34 +01:00
zeertzjq
efe5ce6fa8
vim-patch:9.0.1223: cannot use setcellwidths() below 0x100 (#21929)
Problem:    Cannot use setcellwidths() below 0x100.
Solution:   Also accept characters between 0x80 and 0x100. (Ken Takata,
            closes vim/vim#11834)

7193323b77

Co-authored-by: K.Takata <kentkt@csc.jp>
2023-01-21 08:44:14 +08:00
Sizhe Zhao
c41214c7d4
docs: docs: use codeblocks in runtime/doc/options.txt (#21919)
ensure correct parsing with tree-sitter

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
2023-01-20 17:29:15 +01:00
luukvbaal
999bb983f0
perf(statuscolumn): only fill click defs array once per redraw (#21884)
Problem:    'statuscolumn' click definitions are cleared, evaluated,
            allocated and filled each redraw for every row in a window.
            This despite the fact that we only store a single click
            definition array for the entire column as opposed to one
            for each row.
Solution:   Only fill the 'statuscolumn' click definition array once per
            window per redraw.

Resolve https://github.com/neovim/neovim/issues/21767.
2023-01-20 07:47:02 +08:00
zeertzjq
f8669e8a18
vim-patch:8.2.1698: cannot lock a variable in legacy Vim script like in Vim9 (#21883)
Problem:    Cannot lock a variable in legacy Vim script like in Vim9.
Solution:   Make ":lockvar 0" work.

a187c43cfe

Co-authored-by: Bram Moolenaar <Bram@vim.org>
2023-01-19 08:03:13 +08:00
zeertzjq
f4e03cbdbc
vim-patch:9.0.1212: cannot read back what setcellwidths() has done (#21867)
Problem:    Cannot read back what setcellwidths() has done.
Solution:   Add getcellwidths(). (Kota Kato, closes vim/vim#11837)

66bb9ae70f

Co-authored-by: Kota Kato <github@kat0h.com>
2023-01-18 06:50:22 +08:00
zeertzjq
3db2139195 vim-patch:8.2.4617: no completion for :scriptnames
Problem:    No completion for :scriptnames.
Solution:   Implement :scriptnames completion. (Yegappan Lakshmanan,
            closes vim/vim#10005)

454ce6737c

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-17 20:26:06 +08:00
zeertzjq
441d13eae5 vim-patch:8.2.4482: no fuzzy cmdline completion for user defined completion
Problem:    No fuzzy cmdline completion for user defined completion.
Solution:   Add fuzzy completion for user defined completion. (Yegappan
            Lakshmanan, closes vim/vim#9858)

afd4ae35d6

Cherry-pick related docs from Vim runtime.

N/A patches for version.c:

vim-patch:8.2.4485: compiler warning for uninitialized variable
vim-patch:8.2.4732: duplicate code to free fuzzy matches

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-17 15:55:58 +08:00
zeertzjq
15e42dd449 vim-patch:8.2.4608: getcompletion() does not work when 'wildoptions' has "fuzzy"
Problem:    getcompletion() does not work properly when 'wildoptions
            contains "fuzzy".
Solution:   Do not use addstar(). (Yegappan Lakshmanan, closes vim/vim#9992,
            closes vim/vim#9986)

e7dd0fa2c6

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-17 14:01:26 +08:00
Sean Dewar
6734dd2503 vim-patch:8.2.4463: completion only uses strict matching
Problem:    Completion only uses strict matching.
Solution:   Add the "fuzzy" item for 'wildoptions'. (Yegappan Lakshmanan,
            closes vim/vim#9803)

38b85cb4d7

Use MAX_FUZZY_MATCHES in fuzzy_match_str().
Omit fuzmatch_str_free() as it is only used on allocation failure.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-01-17 14:01:10 +08:00
Luuk van Baal
85111ca0f4 fix(column)!: ensure 'statuscolumn' works with virtual and wrapped lines
Problem:    The `'statuscolumn'` was not re-evaluated for wrapped lines,
            when preceded by virtual/filler lines. There was also no way
            to distinguish virtual and wrapped lines in the status column.
Solution:   Make sure to rebuild the statuscolumn, and replace variable
            `v:wrap` with `v:virtnum`. `v:virtnum` is negative when drawing
            virtual lines, zero when drawing the actual buffer line, and
            positive when drawing the wrapped part of a buffer line.
2023-01-16 14:03:09 +01:00