From f449a38f6a47bee30f0d4e291d8234d1ac8288a7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 9 Oct 2024 08:14:18 +0800 Subject: vim-patch:9.1.0770: current command line completion is a bit limited (#30728) Problem: current command completion is a bit limited Solution: Add the shellcmdline completion type and getmdcomplpat() function (Ruslan Russkikh). closes: vim/vim#15823 https://github.com/vim/vim/commit/0407d621bbad020b840ffbbbd25ba023bbc05edd Co-authored-by: Ruslan Russkikh --- runtime/lua/vim/_meta/vimfn.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 3f6deba092..1e1e87fca8 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -2879,12 +2879,22 @@ function vim.fn.getcharsearch() end --- @return string function vim.fn.getcharstr(expr) end +--- Return completion pattern of the current command-line. +--- Only works when the command line is being edited, thus +--- requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. +--- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, +--- |getcmdprompt()|, |getcmdcompltype()| and |setcmdline()|. +--- Returns an empty string when completion is not defined. +--- +--- @return string +function vim.fn.getcmdcomplpat() end + --- Return the type of the current command-line completion. --- Only works when the command line is being edited, thus --- requires use of |c_CTRL-\_e| or |c_CTRL-R_=|. --- See |:command-completion| for the return string. --- Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|, ---- |getcmdprompt()| and |setcmdline()|. +--- |getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|. --- Returns an empty string when completion is not defined. --- --- @return string -- cgit From 6f1601a1b94e6ea724d8436600c64760525d1d2b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 11 Oct 2024 06:48:45 +0800 Subject: vim-patch:9.1.0774: "shellcmdline" doesn't work with getcompletion() (#30750) Problem: "shellcmdline" doesn't work with getcompletion(). Solution: Use set_context_for_wildcard_arg() (zeertzjq). closes: vim/vim#15834 https://github.com/vim/vim/commit/85f36d61e09b12d6f1c60201129823371daa4a84 --- runtime/lua/vim/_meta/vimfn.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 1e1e87fca8..81e7070ac0 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -3008,6 +3008,7 @@ function vim.fn.getcmdwintype() end --- runtime |:runtime| completion --- scriptnames sourced script names |:scriptnames| --- shellcmd Shell command +--- shellcmdline Shell command line with filename arguments --- sign |:sign| suboptions --- syntax syntax file names |'syntax'| --- syntime |:syntime| suboptions -- cgit From 9701cbf036aecf18e7d88681040c07d61c314ca6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 15 Oct 2024 08:16:56 +0800 Subject: vim-patch:7b5e52d: runtime(doc): add preview flag to statusline example Problem: The standard statusline example is missing the preview flag "%w" Solution: Add the preview flag "%w" closes: vim/vim#15874 https://github.com/vim/vim/commit/7b5e52d16fb457c90cc44340a6190712aab7e03b Co-authored-by: saher --- runtime/lua/vim/_meta/options.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index ce3ff4f861..1270ad2519 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -6695,7 +6695,7 @@ vim.wo.stc = vim.wo.statuscolumn --- Emulate standard status line with 'ruler' set --- --- ```vim ---- set statusline=%<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P +--- set statusline=%<%f\ %h%w%m%r%=%-14.(%l,%c%V%)\ %P --- ``` --- Similar, but add ASCII value of char under the cursor (like "ga") --- -- cgit From dbd172e7e953bdab7132bd635532295a4dc64af9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 15 Oct 2024 08:20:09 +0800 Subject: vim-patch:5bcfb5a: runtime(doc): add some docs for file-watcher programs fixes: vim/vim#15733 https://github.com/vim/vim/commit/5bcfb5a30cfd8e8574061bdd82a192f47aae09b5 Co-authored-by: Christian Brabandt --- runtime/lua/vim/_meta/options.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 1270ad2519..36c0f583c7 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -289,12 +289,13 @@ vim.go.bk = vim.go.backup --- useful for example in source trees where all the files are symbolic or --- hard links and any changes should stay in the local source tree, not --- be propagated back to the original source. ---- *crontab* +--- *crontab* --- One situation where "no" and "auto" will cause problems: A program --- that opens a file, invokes Vim to edit that file, and then tests if --- the open file was changed (through the file descriptor) will check the --- backup file instead of the newly created file. "crontab -e" is an ---- example. +--- example, as are several `file-watcher` daemons like inotify. In that +--- case you probably want to switch this option. --- --- When a copy is made, the original file is truncated and then filled --- with the new text. This means that protection bits, owner and -- cgit From 84623dbe93777c0a8e7ddf57470ddeb2ea738069 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 15 Oct 2024 18:53:59 +0800 Subject: vim-patch:9.1.0785: cannot preserve error position when setting quickfix list (#30820) Problem: cannot preserve error position when setting quickfix lists Solution: Add the 'u' action for setqflist()/setloclist() and try to keep the closes target position (Jeremy Fleischman) fixes: vim/vim#15839 closes: vim/vim#15841 https://github.com/vim/vim/commit/27fbf6e5e8bee5c6b61819a5e82a0b50b265f0b0 Co-authored-by: Jeremy Fleischman --- runtime/lua/vim/_meta/vimfn.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 81e7070ac0..f588162112 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -8229,6 +8229,8 @@ function vim.fn.setpos(expr, list) end --- clear the list: >vim --- call setqflist([], 'r') --- < +--- 'u' Like 'r', but tries to preserve the current selection +--- in the quickfix list. --- 'f' All the quickfix lists in the quickfix stack are --- freed. --- -- cgit From 82b02ae2f2af439a8c678ed6b55a43121055f279 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 12 Oct 2024 11:23:31 +0200 Subject: fix(runtime): clean up one-off scripts Problem: Some runtime files no longer spark joy. Solution: Kondo the place up. Still sparks _some_ joy (moved to new `runtime/scripts` folder): * `macros/less.*` * `mswin.vim` * `tools/emoji_list.lua` No longer sparks joy (removed): * `macmap.vim` (gvimrc file; not useful in Nvim) * `tools/check_colors.vim` (no longer useful with new default colorscheme and treesitter) * `macros/editexisting.vim` (throws error on current Nvim) * `macros/justify.vim` (obsolete shim for `packadd! justify`) * `macros/matchit.vim` (same) * `macros/shellmenu.vim` (same) * `macros/swapmous.vim` (same) --- runtime/lua/vim/_meta/vimfn.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index f588162112..de1937f620 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -7923,7 +7923,7 @@ function vim.fn.setbufvar(buf, varname, val) end --- To clear the overrides pass an empty {list}: >vim --- call setcellwidths([]) --- ---- Date: Thu, 17 Oct 2024 07:48:42 +0800 Subject: vim-patch:6c2fc37: runtime(help): Update help syntax This commit makaes the following changes to the vim help syntax: - fix excessive URL detection in help, because `file:{filename}` in doc/options.txt is determined to be a URL. - update highlighting N for :resize in help - split Italian-specific syntax into separate help script - highlight `Note` in parentheses in help - update 'titlestring' behaviour in documentation for invalid '%' format closes: vim/vim#15883 https://github.com/vim/vim/commit/6c2fc377bfbfb6f1a46b1061413cd21116b596ed Co-authored-by: Milly --- runtime/lua/vim/_meta/options.lua | 4 +++- runtime/lua/vim/_meta/vimfn.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 36c0f583c7..c33753047f 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -7310,7 +7310,9 @@ vim.go.titleold = vim.o.titleold --- window. This happens only when the 'title' option is on. --- --- When this option contains printf-style '%' items, they will be ---- expanded according to the rules used for 'statusline'. +--- expanded according to the rules used for 'statusline'. If it contains +--- an invalid '%' format, the value is used as-is and no error or warning +--- will be given when the value is set. --- This option cannot be set in a modeline when 'modelineexpr' is off. --- --- Example: diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index de1937f620..d00bbe4770 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -10629,7 +10629,7 @@ function vim.fn.wait(timeout, condition, interval) end --- For example to make work like in wildmode, use: >vim --- cnoremap wildmenumode() ? "\\" : "\" --- < ---- (Note, this needs the 'wildcharm' option set appropriately). +--- (Note: this needs the 'wildcharm' option set appropriately). --- --- @return any function vim.fn.wildmenumode() end -- cgit From 21151144c6ee0d38841aea78b2e0ecb8a0046429 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 16 Oct 2024 09:33:13 +0100 Subject: feat(meta): add type for quickfix entries --- runtime/lua/vim/_meta/builtin_types.lua | 91 +++++++++++++++++++++++++++++++++ runtime/lua/vim/_meta/vimfn.lua | 4 +- 2 files changed, 93 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/builtin_types.lua b/runtime/lua/vim/_meta/builtin_types.lua index aca6649957..eae76d80d7 100644 --- a/runtime/lua/vim/_meta/builtin_types.lua +++ b/runtime/lua/vim/_meta/builtin_types.lua @@ -66,6 +66,97 @@ --- @field winnr integer --- @field winrow integer +--- @class vim.quickfix.entry +--- buffer number; must be the number of a valid buffer +--- @field bufnr? integer +--- +--- name of a file; only used when "bufnr" is not +--- present or it is invalid. +--- @field filename? string +--- +--- name of a module; if given it will be used in +--- quickfix error window instead of the filename. +--- @field module? string +--- +--- line number in the file +--- @field lnum? integer +--- +--- end of lines, if the item spans multiple lines +--- @field end_lnum? integer +--- +--- search pattern used to locate the error +--- @field pattern? string +--- +--- column number +--- @field col? integer +--- +--- when non-zero: "col" is visual column +--- when zero: "col" is byte index +--- @field vcol? integer +--- +--- end column, if the item spans multiple columns +--- @field end_col? integer +--- +--- error number +--- @field nr? integer +--- +--- description of the error +--- @field text? string +--- +--- single-character error type, 'E', 'W', etc. +--- @field type? string +--- +--- recognized error message +--- @field valid? boolean +--- +--- custom data associated with the item, can be +--- any type. +--- @field user_data? any + +--- @class vim.fn.setqflist.what +--- +--- quickfix list context. See |quickfix-context| +--- @field context? table +--- +--- errorformat to use when parsing text from +--- "lines". If this is not present, then the +--- 'errorformat' option value is used. +--- See |quickfix-parse| +--- @field efm? string +--- +--- quickfix list identifier |quickfix-ID| +--- @field id? integer +--- index of the current entry in the quickfix +--- list specified by "id" or "nr". If set to '$', +--- then the last entry in the list is set as the +--- current entry. See |quickfix-index| +--- @field idx? integer +--- +--- list of quickfix entries. Same as the {list} +--- argument. +--- @field items? vim.quickfix.entry[] +--- +--- use 'errorformat' to parse a list of lines and +--- add the resulting entries to the quickfix list +--- {nr} or {id}. Only a |List| value is supported. +--- See |quickfix-parse| +--- @field lines? string[] +--- +--- list number in the quickfix stack; zero +--- means the current quickfix list and "$" means +--- the last quickfix list. +--- @field nr? integer +--- +--- function to get the text to display in the +--- quickfix window. The value can be the name of +--- a function or a funcref or a lambda. Refer +--- to |quickfix-window-function| for an explanation +--- of how to write the function and an example. +--- @field quickfixtextfunc? function +--- +--- quickfix list title text. See |quickfix-title| +--- @field title? string + --- @class vim.fn.sign_define.dict --- @field text string --- @field icon? string diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index de1937f620..4e5d3f5701 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -8286,9 +8286,9 @@ function vim.fn.setpos(expr, list) end --- independent of the 'errorformat' setting. Use a command like --- `:cc 1` to jump to the first position. --- ---- @param list any[] +--- @param list vim.quickfix.entry[] --- @param action? string ---- @param what? table +--- @param what? vim.fn.setqflist.what --- @return any function vim.fn.setqflist(list, action, what) end -- cgit From 3cf602486ce5cfaa50f33edbe179928f84527dc9 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 20 Oct 2024 07:59:43 +0800 Subject: feat(terminal)!: make 'belloff' and 'visualbell' apply to terminal bell (#30859) vim-patch:8.2.4744: a terminal window can't use the bell vim-patch:8.2.4745: using wrong flag for using bell in the terminal BREAKING CHANGE: Bells from :terminal are now silent by default, unless 'belloff' option doesn't contain "term" or "all". --- runtime/lua/vim/_meta/options.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index c33753047f..cf70429ce5 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -430,6 +430,7 @@ vim.go.bsk = vim.go.backupskip --- separated list of items. For each item that is present, the bell --- will be silenced. This is most useful to specify specific events in --- insert mode to be silenced. +--- You can also make it flash by using 'visualbell'. --- --- item meaning when present ~ --- all All events. @@ -453,6 +454,7 @@ vim.go.bsk = vim.go.backupskip --- register Unknown register after in `Insert-mode`. --- shell Bell from shell output `:!`. --- spell Error happened on spell suggest. +--- term Bell from `:terminal` output. --- wildmode More matches in `cmdline-completion` available --- (depends on the 'wildmode' setting). --- -- cgit From 9b8907d90508d7b66f025bbd1f5a48a78c5ce035 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 20 Oct 2024 22:18:26 +0800 Subject: feat(float): allow enabling mouse for non-focusable window (#30844) Problem: Cannot allow mouse interaction for non-focusable float window. Solution: Add a "mouse" field to float window config. --- runtime/lua/vim/_meta/api.lua | 7 ++++++- runtime/lua/vim/_meta/api_keysets.lua | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c66b295d3a..8236cc7cf0 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1767,7 +1767,12 @@ function vim.api.nvim_open_term(buffer, opts) end --- fractional. --- - focusable: Enable focus by user actions (wincmds, mouse events). --- Defaults to true. Non-focusable windows can be entered by ---- `nvim_set_current_win()`. +--- `nvim_set_current_win()`, or, when the `mouse` field is set to true, +--- by mouse events. +--- - mouse: Specify how this window interacts with mouse events. +--- Defaults to `focusable` value. +--- - If false, mouse events pass through this window. +--- - If true, mouse events interact with this window normally. --- - external: GUI should display the window as an external --- top-level window. Currently accepts no other positioning --- configuration together with this. diff --git a/runtime/lua/vim/_meta/api_keysets.lua b/runtime/lua/vim/_meta/api_keysets.lua index 2fe5c32faf..bf184dee2d 100644 --- a/runtime/lua/vim/_meta/api_keysets.lua +++ b/runtime/lua/vim/_meta/api_keysets.lua @@ -295,6 +295,7 @@ error('Cannot require a meta file') --- @field bufpos? any[] --- @field external? boolean --- @field focusable? boolean +--- @field mouse? boolean --- @field vertical? boolean --- @field zindex? integer --- @field border? any -- cgit From c8e47f648052f8001d8a493cf7ca6c4867a36bc3 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 21 Oct 2024 11:36:02 +0100 Subject: fix(meta): do not use hyphens in param names Fixes #30882 --- runtime/lua/vim/_meta/vimfn.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index f40a94a442..bde3101479 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -221,16 +221,16 @@ function vim.fn.assert_beeps(cmd) end --- @return 0|1 function vim.fn.assert_equal(expected, actual, msg) end ---- When the files {fname-one} and {fname-two} do not contain +--- When the files {fname_one} and {fname_two} do not contain --- exactly the same text an error message is added to |v:errors|. --- Also see |assert-return|. ---- When {fname-one} or {fname-two} does not exist the error will +--- When {fname_one} or {fname_two} does not exist the error will --- mention that. --- ---- @param fname-one string ---- @param fname-two string +--- @param fname_one string +--- @param fname_two string --- @return 0|1 -function vim.fn.assert_equalfile(fname-one, fname-two) end +function vim.fn.assert_equalfile(fname_one, fname_two) end --- When v:exception does not contain the string {error} an error --- message is added to |v:errors|. Also see |assert-return|. -- cgit From 07b4cb6ada2da108bbf8277bec63068234ceaa67 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Tue, 22 Oct 2024 22:14:01 +0600 Subject: docs(options): remove description for hidden options #30903 Problem: Hidden options are documented despite being no-ops. Solution: Remove docs for hidden options. Move tags for options that we plan to restore, to ":help nvim-missing". Move tags for permanently removed options, to ":help nvim-removed". --- runtime/lua/vim/_meta/options.lua | 259 -------------------------------------- 1 file changed, 259 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index cf70429ce5..00f7554832 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -575,19 +575,6 @@ vim.o.briopt = vim.o.breakindentopt vim.wo.breakindentopt = vim.o.breakindentopt vim.wo.briopt = vim.wo.breakindentopt ---- Which directory to use for the file browser: ---- last Use same directory as with last file browser, where a ---- file was opened or saved. ---- buffer Use the directory of the related buffer. ---- current Use the current directory. ---- {path} Use the specified directory ---- ---- @type string -vim.o.browsedir = "" -vim.o.bsdir = vim.o.browsedir -vim.go.browsedir = vim.o.browsedir -vim.go.bsdir = vim.go.browsedir - --- This option specifies what happens when a buffer is no longer --- displayed in a window: --- follow the global 'hidden' option @@ -2900,148 +2887,6 @@ vim.o.gfw = vim.o.guifontwide vim.go.guifontwide = vim.o.guifontwide vim.go.gfw = vim.go.guifontwide ---- This option only has an effect in the GUI version of Vim. It is a ---- sequence of letters which describes what components and options of the ---- GUI should be used. ---- To avoid problems with flags that are added in the future, use the ---- "+=" and "-=" feature of ":set" `add-option-flags`. ---- ---- Valid letters are as follows: ---- *guioptions_a* *'go-a'* ---- 'a' Autoselect: If present, then whenever VISUAL mode is started, ---- or the Visual area extended, Vim tries to become the owner of ---- the windowing system's global selection. This means that the ---- Visually highlighted text is available for pasting into other ---- applications as well as into Vim itself. When the Visual mode ---- ends, possibly due to an operation on the text, or when an ---- application wants to paste the selection, the highlighted text ---- is automatically yanked into the "* selection register. ---- Thus the selection is still available for pasting into other ---- applications after the VISUAL mode has ended. ---- If not present, then Vim won't become the owner of the ---- windowing system's global selection unless explicitly told to ---- by a yank or delete operation for the "* register. ---- The same applies to the modeless selection. ---- *'go-P'* ---- 'P' Like autoselect but using the "+ register instead of the "* ---- register. ---- *'go-A'* ---- 'A' Autoselect for the modeless selection. Like 'a', but only ---- applies to the modeless selection. ---- ---- 'guioptions' autoselect Visual autoselect modeless ~ ---- "" - - ---- "a" yes yes ---- "A" - yes ---- "aA" yes yes ---- ---- *'go-c'* ---- 'c' Use console dialogs instead of popup dialogs for simple ---- choices. ---- *'go-d'* ---- 'd' Use dark theme variant if available. ---- *'go-e'* ---- 'e' Add tab pages when indicated with 'showtabline'. ---- 'guitablabel' can be used to change the text in the labels. ---- When 'e' is missing a non-GUI tab pages line may be used. ---- The GUI tabs are only supported on some systems, currently ---- Mac OS/X and MS-Windows. ---- *'go-i'* ---- 'i' Use a Vim icon. ---- *'go-m'* ---- 'm' Menu bar is present. ---- *'go-M'* ---- 'M' The system menu "$VIMRUNTIME/menu.vim" is not sourced. Note ---- that this flag must be added in the vimrc file, before ---- switching on syntax or filetype recognition (when the `gvimrc` ---- file is sourced the system menu has already been loaded; the ---- `:syntax on` and `:filetype on` commands load the menu too). ---- *'go-g'* ---- 'g' Grey menu items: Make menu items that are not active grey. If ---- 'g' is not included inactive menu items are not shown at all. ---- *'go-T'* ---- 'T' Include Toolbar. Currently only in Win32 GUI. ---- *'go-r'* ---- 'r' Right-hand scrollbar is always present. ---- *'go-R'* ---- 'R' Right-hand scrollbar is present when there is a vertically ---- split window. ---- *'go-l'* ---- 'l' Left-hand scrollbar is always present. ---- *'go-L'* ---- 'L' Left-hand scrollbar is present when there is a vertically ---- split window. ---- *'go-b'* ---- 'b' Bottom (horizontal) scrollbar is present. Its size depends on ---- the longest visible line, or on the cursor line if the 'h' ---- flag is included. `gui-horiz-scroll` ---- *'go-h'* ---- 'h' Limit horizontal scrollbar size to the length of the cursor ---- line. Reduces computations. `gui-horiz-scroll` ---- ---- And yes, you may even have scrollbars on the left AND the right if ---- you really want to :-). See `gui-scrollbars` for more information. ---- ---- *'go-v'* ---- 'v' Use a vertical button layout for dialogs. When not included, ---- a horizontal layout is preferred, but when it doesn't fit a ---- vertical layout is used anyway. Not supported in GTK 3. ---- *'go-p'* ---- 'p' Use Pointer callbacks for X11 GUI. This is required for some ---- window managers. If the cursor is not blinking or hollow at ---- the right moment, try adding this flag. This must be done ---- before starting the GUI. Set it in your `gvimrc`. Adding or ---- removing it after the GUI has started has no effect. ---- *'go-k'* ---- 'k' Keep the GUI window size when adding/removing a scrollbar, or ---- toolbar, tabline, etc. Instead, the behavior is similar to ---- when the window is maximized and will adjust 'lines' and ---- 'columns' to fit to the window. Without the 'k' flag Vim will ---- try to keep 'lines' and 'columns' the same when adding and ---- removing GUI components. ---- ---- @type string -vim.o.guioptions = "" -vim.o.go = vim.o.guioptions -vim.go.guioptions = vim.o.guioptions -vim.go.go = vim.go.guioptions - ---- When non-empty describes the text to use in a label of the GUI tab ---- pages line. When empty and when the result is empty Vim will use a ---- default label. See `setting-guitablabel` for more info. ---- ---- The format of this option is like that of 'statusline'. ---- 'guitabtooltip' is used for the tooltip, see below. ---- The expression will be evaluated in the `sandbox` when set from a ---- modeline, see `sandbox-option`. ---- This option cannot be set in a modeline when 'modelineexpr' is off. ---- ---- Only used when the GUI tab pages line is displayed. 'e' must be ---- present in 'guioptions'. For the non-GUI tab pages line 'tabline' is ---- used. ---- ---- @type string -vim.o.guitablabel = "" -vim.o.gtl = vim.o.guitablabel -vim.go.guitablabel = vim.o.guitablabel -vim.go.gtl = vim.go.guitablabel - ---- When non-empty describes the text to use in a tooltip for the GUI tab ---- pages line. When empty Vim will use a default tooltip. ---- This option is otherwise just like 'guitablabel' above. ---- You can include a line break. Simplest method is to use `:let`: ---- ---- ```vim ---- let &guitabtooltip = "line one\nline two" ---- ``` ---- ---- ---- @type string -vim.o.guitabtooltip = "" -vim.o.gtt = vim.o.guitabtooltip -vim.go.guitabtooltip = vim.o.guitabtooltip -vim.go.gtt = vim.go.guitabtooltip - --- Name of the main help file. All distributed help files should be --- placed together in one directory. Additionally, all "doc" directories --- in 'runtimepath' will be used. @@ -3184,29 +3029,6 @@ vim.o.ic = vim.o.ignorecase vim.go.ignorecase = vim.o.ignorecase vim.go.ic = vim.go.ignorecase ---- When set the Input Method is always on when starting to edit a command ---- line, unless entering a search pattern (see 'imsearch' for that). ---- Setting this option is useful when your input method allows entering ---- English characters directly, e.g., when it's used to type accented ---- characters with dead keys. ---- ---- @type boolean -vim.o.imcmdline = false -vim.o.imc = vim.o.imcmdline -vim.go.imcmdline = vim.o.imcmdline -vim.go.imc = vim.go.imcmdline - ---- When set the Input Method is never used. This is useful to disable ---- the IM when it doesn't work properly. ---- Currently this option is on by default for SGI/IRIX machines. This ---- may change in later releases. ---- ---- @type boolean -vim.o.imdisable = false -vim.o.imd = vim.o.imdisable -vim.go.imdisable = vim.o.imdisable -vim.go.imd = vim.go.imdisable - --- Specifies whether :lmap or an Input Method (IM) is to be used in --- Insert mode. Valid values: --- 0 :lmap is off and IM is off @@ -4491,74 +4313,6 @@ vim.go.mousemev = vim.go.mousemoveevent vim.o.mousescroll = "ver:3,hor:6" vim.go.mousescroll = vim.o.mousescroll ---- This option tells Vim what the mouse pointer should look like in ---- different modes. The option is a comma-separated list of parts, much ---- like used for 'guicursor'. Each part consist of a mode/location-list ---- and an argument-list: ---- mode-list:shape,mode-list:shape,.. ---- The mode-list is a dash separated list of these modes/locations: ---- In a normal window: ~ ---- n Normal mode ---- v Visual mode ---- ve Visual mode with 'selection' "exclusive" (same as 'v', ---- if not specified) ---- o Operator-pending mode ---- i Insert mode ---- r Replace mode ---- ---- Others: ~ ---- c appending to the command-line ---- ci inserting in the command-line ---- cr replacing in the command-line ---- m at the 'Hit ENTER' or 'More' prompts ---- ml idem, but cursor in the last line ---- e any mode, pointer below last window ---- s any mode, pointer on a status line ---- sd any mode, while dragging a status line ---- vs any mode, pointer on a vertical separator line ---- vd any mode, while dragging a vertical separator line ---- a everywhere ---- ---- The shape is one of the following: ---- avail name looks like ~ ---- w x arrow Normal mouse pointer ---- w x blank no pointer at all (use with care!) ---- w x beam I-beam ---- w x updown up-down sizing arrows ---- w x leftright left-right sizing arrows ---- w x busy The system's usual busy pointer ---- w x no The system's usual "no input" pointer ---- x udsizing indicates up-down resizing ---- x lrsizing indicates left-right resizing ---- x crosshair like a big thin + ---- x hand1 black hand ---- x hand2 white hand ---- x pencil what you write with ---- x question big ? ---- x rightup-arrow arrow pointing right-up ---- w x up-arrow arrow pointing up ---- x any X11 pointer number (see X11/cursorfont.h) ---- ---- The "avail" column contains a 'w' if the shape is available for Win32, ---- x for X11. ---- Any modes not specified or shapes not available use the normal mouse ---- pointer. ---- ---- Example: ---- ---- ```vim ---- set mouseshape=s:udsizing,m:no ---- ``` ---- will make the mouse turn to a sizing arrow over the status lines and ---- indicate no input when the hit-enter prompt is displayed (since ---- clicking the mouse has no effect in this state.) ---- ---- @type string -vim.o.mouseshape = "" -vim.o.mouses = vim.o.mouseshape -vim.go.mouseshape = vim.o.mouseshape -vim.go.mouses = vim.go.mouseshape - --- Defines the maximum time in msec between two mouse clicks for the --- second click to be recognized as a multi click. --- @@ -4678,19 +4432,6 @@ vim.o.ofu = vim.o.omnifunc vim.bo.omnifunc = vim.o.omnifunc vim.bo.ofu = vim.bo.omnifunc ---- only for Windows ---- Enable reading and writing from devices. This may get Vim stuck on a ---- device that can be opened but doesn't actually do the I/O. Therefore ---- it is off by default. ---- Note that on Windows editing "aux.h", "lpt1.txt" and the like also ---- result in editing a device. ---- ---- @type boolean -vim.o.opendevice = false -vim.o.odev = vim.o.opendevice -vim.go.opendevice = vim.o.opendevice -vim.go.odev = vim.go.opendevice - --- This option specifies a function to be called by the `g@` operator. --- See `:map-operator` for more info and an example. The value can be --- the name of a function, a `lambda` or a `Funcref`. See -- cgit From 3a86b60032bd659c2b12e984abb40cee93568558 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 29 Sep 2024 14:07:21 +0200 Subject: docs: misc Co-authored-by: David Pedersen Co-authored-by: Gregory Anders Co-authored-by: Leo Schlosser Co-authored-by: zeertzjq --- runtime/lua/vim/_meta/vimfn.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index bde3101479..a751783c8f 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -5192,7 +5192,7 @@ function vim.fn.log(expr) end function vim.fn.log10(expr) end --- {expr1} must be a |List|, |String|, |Blob| or |Dictionary|. ---- When {expr1} is a |List|| or |Dictionary|, replace each +--- When {expr1} is a |List| or |Dictionary|, replace each --- item in {expr1} with the result of evaluating {expr2}. --- For a |Blob| each byte is replaced. --- For a |String|, each character, including composing -- cgit From 230b0c7f021a57647a658edce27fe115343f083f Mon Sep 17 00:00:00 2001 From: Tristan Knight Date: Wed, 23 Oct 2024 14:33:57 +0100 Subject: feat(stdlib): overload vim.str_byteindex, vim.str_utfindex #30735 PROBLEM: There are several limitations to vim.str_byteindex, vim.str_utfindex: 1. They throw given out-of-range indexes. An invalid (often user/lsp-provided) index doesn't feel exceptional and should be handled by the caller. `:help dev-error-patterns` suggests that `retval, errmsg` is the preferred way to handle this kind of failure. 2. They cannot accept an encoding. So LSP needs wrapper functions. #25272 3. The current signatures are not extensible. * Calling: The function currently uses a fairly opaque boolean value to indicate to identify the encoding. * Returns: The fact it can throw requires wrapping in pcall. 4. The current name doesn't follow suggestions in `:h dev-naming` and I think `get` would be suitable. SOLUTION: - Because these are performance-sensitive, don't introduce `opts`. - Introduce an "overload" that accepts `encoding:string` and `strict_indexing:bool` params. ```lua local col = vim.str_utfindex(line, encoding, [index, [no_out_of_range]]) ``` Support the old versions by dispatching on the type of argument 2, and deprecate that form. ```lua vim.str_utfindex(line) -- (utf-32 length, utf-16 length), deprecated vim.str_utfindex(line, index) -- (utf-32 index, utf-16 index), deprecated vim.str_utfindex(line, 'utf-16') -- utf-16 length vim.str_utfindex(line, 'utf-16', index) -- utf-16 index vim.str_utfindex(line, 'utf-16', math.huge) -- error: index out of range vim.str_utfindex(line, 'utf-16', math.huge, false) -- utf-16 length ``` --- runtime/lua/vim/_meta/builtin.lua | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index 13bd1c1294..234c75d38f 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -112,18 +112,6 @@ function vim.rpcrequest(channel, method, ...) end --- equal, {a} is greater than {b} or {a} is lesser than {b}, respectively. function vim.stricmp(a, b) end ---- Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not ---- supplied, it defaults to false (use UTF-32). Returns the byte index. ---- ---- Invalid UTF-8 and NUL is treated like in |vim.str_utfindex()|. ---- An {index} in the middle of a UTF-16 sequence is rounded upwards to ---- the end of that sequence. ---- @param str string ---- @param index integer ---- @param use_utf16? boolean ---- @return integer -function vim.str_byteindex(str, index, use_utf16) end - --- Gets a list of the starting byte positions of each UTF-8 codepoint in the given string. --- --- Embedded NUL bytes are treated as terminating the string. @@ -173,19 +161,6 @@ function vim.str_utf_start(str, index) end --- @return integer function vim.str_utf_end(str, index) end ---- Convert byte index to UTF-32 and UTF-16 indices. If {index} is not ---- supplied, the length of the string is used. All indices are zero-based. ---- ---- Embedded NUL bytes are treated as terminating the string. Invalid UTF-8 ---- bytes, and embedded surrogates are counted as one code point each. An ---- {index} in the middle of a UTF-8 sequence is rounded upwards to the end of ---- that sequence. ---- @param str string ---- @param index? integer ---- @return integer # UTF-32 index ---- @return integer # UTF-16 index -function vim.str_utfindex(str, index) end - --- The result is a String, which is the text {str} converted from --- encoding {from} to encoding {to}. When the conversion fails `nil` is --- returned. When some characters could not be converted they -- cgit From 378d9135e7ac0f91a4944be816dc9f693d5078af Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 28 Oct 2024 15:14:15 +0800 Subject: vim-patch:9.1.0810: cannot easily adjust the |:find| command Problem: cannot easily adjust the |:find| command Solution: Add support for the 'findexpr' option (Yegappan Lakshmanan) closes: vim/vim#15901 closes: vim/vim#15905 https://github.com/vim/vim/commit/aeb1c97db5b9de4f4903e7f288f2aa5ad6c49440 Co-authored-by: Yegappan Lakshmanan --- runtime/lua/vim/_meta/options.lua | 51 +++++++++++++++++++++++++++++++++++++++ runtime/lua/vim/_meta/vvars.lua | 3 ++- 2 files changed, 53 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 00f7554832..8d5601ff6a 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -2294,6 +2294,57 @@ vim.wo.fcs = vim.wo.fillchars vim.go.fillchars = vim.o.fillchars vim.go.fcs = vim.go.fillchars +--- Expression that is evaluated to obtain the filename(s) for the `:find` +--- command. When this option is empty, the internal `file-searching` +--- mechanism is used. +--- +--- While evaluating the expression, the `v:fname` variable is set to the +--- argument of the `:find` command. +--- +--- The expression is evaluated only once per `:find` command invocation. +--- The expression can process all the directories specified in 'path'. +--- +--- If a match is found, the expression should return a `List` containing +--- one or more file names. If a match is not found, the expression +--- should return an empty List. +--- +--- If any errors are encountered during the expression evaluation, an +--- empty List is used as the return value. +--- +--- Using a function call without arguments is faster `expr-option-function` +--- +--- It is not allowed to change text or jump to another window while +--- evaluating 'findexpr' `textlock`. +--- +--- This option cannot be set from a `modeline` or in the `sandbox`, for +--- security reasons. +--- +--- Examples: +--- +--- ```vim +--- " Use glob() +--- func FindExprGlob() +--- return glob(v:fname, v:false, v:true) +--- endfunc +--- set findexpr=FindExprGlob() +--- +--- " Use the 'git ls-files' output +--- func FindGitFiles() +--- let fnames = systemlist('git ls-files') +--- return fnames->filter('v:val =~? v:fname') +--- endfunc +--- set findexpr=FindGitFiles() +--- ``` +--- +--- +--- @type string +vim.o.findexpr = "" +vim.o.fexpr = vim.o.findexpr +vim.bo.findexpr = vim.o.findexpr +vim.bo.fexpr = vim.bo.findexpr +vim.go.findexpr = vim.o.findexpr +vim.go.fexpr = vim.go.findexpr + --- When writing a file and this option is on, at the end of file --- will be restored if missing. Turn this option off if you want to --- preserve the situation from the original file. diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index e00402ab3f..cba200101b 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -267,7 +267,8 @@ vim.v.fcs_choice = ... vim.v.fcs_reason = ... --- When evaluating 'includeexpr': the file name that was ---- detected. Empty otherwise. +--- detected. When evaluating 'findexpr': the argument passed to +--- the `:find` command. Empty otherwise. --- @type string vim.v.fname = ... -- cgit From 60b3ccd850ca038af6fc0a19cad12578f63d67ec Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 29 Oct 2024 07:02:04 +0800 Subject: vim-patch:9.1.0821: 'findexpr' completion doesn't set v:fname to cmdline argument Problem: 'findexpr' completion doesn't set v:fname to cmdline argument. Solution: Set v:fname to the cmdline argument as-is (zeertzjq). closes: vim/vim#15934 https://github.com/vim/vim/commit/20e045f78148c0ef0143c33ffe686fee72d29376 --- runtime/lua/vim/_meta/options.lua | 7 ++++++- runtime/lua/vim/_meta/vvars.lua | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 8d5601ff6a..710f82bf21 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -2304,6 +2304,10 @@ vim.go.fcs = vim.go.fillchars --- The expression is evaluated only once per `:find` command invocation. --- The expression can process all the directories specified in 'path'. --- +--- The expression may be evaluated for command-line completion as well, +--- in which case the `v:cmdcomplete` variable will be set to `v:true`, +--- otherwise it will be set to `v:false`. +--- --- If a match is found, the expression should return a `List` containing --- one or more file names. If a match is not found, the expression --- should return an empty List. @@ -2324,7 +2328,8 @@ vim.go.fcs = vim.go.fillchars --- ```vim --- " Use glob() --- func FindExprGlob() ---- return glob(v:fname, v:false, v:true) +--- let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname +--- return glob(pat, v:false, v:true) --- endfunc --- set findexpr=FindExprGlob() --- diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index cba200101b..b104356334 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -44,6 +44,11 @@ vim.v.cmdarg = ... --- @type integer vim.v.cmdbang = ... +--- When evaluating 'findexpr': if 'findexpr' is used for cmdline +--- completion the value is `v:true`, otherwise it is `v:false`. +--- @type boolean +vim.v.cmdcomplete = ... + --- The current locale setting for collation order of the runtime --- environment. This allows Vim scripts to be aware of the --- current locale encoding. Technical: it's the value of -- cgit From 4c7f5032af6baca61764cde5122765b2ec684e4a Mon Sep 17 00:00:00 2001 From: Kai Moschcau Date: Tue, 29 Oct 2024 15:36:58 +0100 Subject: docs(options): shell-powershell #30969 `-NonInteractive` at least somewhat hints to pwsh/powershell, that shell sessions created from :! are not interactive, though even that is not foolproof, because powershell is weird. `$PSStyle.OutputRendering='plaintext'` causes pwsh/powershell to omit ANSI escape sequences in its output. --- runtime/lua/vim/_meta/options.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 710f82bf21..5e5b6b5ed1 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -5434,7 +5434,7 @@ vim.go.sdf = vim.go.shadafile --- --- ```vim --- let &shell = executable('pwsh') ? 'pwsh' : 'powershell' ---- let &shellcmdflag = '-NoLogo -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' +--- let &shellcmdflag = '-NoLogo -NonInteractive -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues[''Out-File:Encoding'']=''utf8'';$PSStyle.OutputRendering=''plaintext'';Remove-Alias -Force -ErrorAction SilentlyContinue tee;' --- let &shellredir = '2>&1 | %%{ "$_" } | Out-File %s; exit $LastExitCode' --- let &shellpipe = '2>&1 | %%{ "$_" } | tee %s; exit $LastExitCode' --- set shellquote= shellxquote= -- cgit From 7bf3a616e18205d353d9c4a44e8c2f885d700129 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 1 Nov 2024 18:22:08 +0800 Subject: vim-patch:b5e7da1: runtime(doc): mention 'iskeyword' at :h charclass() (#31026) fixes: vim/vim#15965 https://github.com/vim/vim/commit/b5e7da1f27241f7d770d342009e2fb443e45e6ce Co-authored-by: Christian Brabandt --- runtime/lua/vim/_meta/vimfn.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index a751783c8f..7548d1beb2 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -809,7 +809,7 @@ function vim.fn.char2nr(string, utf8) end --- The character class is one of: --- 0 blank --- 1 punctuation ---- 2 word character +--- 2 word character (depends on 'iskeyword') --- 3 emoji --- other specific Unicode class --- The class is used in patterns and word motions. -- cgit From 3075c69ff02faf396e5efbdcb4a255b0b0309649 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 3 Nov 2024 10:06:41 +0800 Subject: vim-patch:9.1.0831: 'findexpr' can't be used as lambad or Funcref (#31058) Problem: 'findexpr' can't be used for lambads (Justin Keyes) Solution: Replace the findexpr option with the findfunc option (Yegappan Lakshmanan) related: vim/vim#15905 closes: vim/vim#15976 https://github.com/vim/vim/commit/a13f3a4f5de9c150f70298850e34747838904995 Co-authored-by: Yegappan Lakshmanan --- runtime/lua/vim/_meta/options.lua | 52 +++++++++++++++++++-------------------- runtime/lua/vim/_meta/vvars.lua | 8 +----- 2 files changed, 27 insertions(+), 33 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 5e5b6b5ed1..f9886957a7 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -2294,31 +2294,31 @@ vim.wo.fcs = vim.wo.fillchars vim.go.fillchars = vim.o.fillchars vim.go.fcs = vim.go.fillchars ---- Expression that is evaluated to obtain the filename(s) for the `:find` +--- Function that is called to obtain the filename(s) for the `:find` --- command. When this option is empty, the internal `file-searching` --- mechanism is used. --- ---- While evaluating the expression, the `v:fname` variable is set to the ---- argument of the `:find` command. +--- The value can be the name of a function, a `lambda` or a `Funcref`. +--- See `option-value-function` for more information. --- ---- The expression is evaluated only once per `:find` command invocation. ---- The expression can process all the directories specified in 'path'. +--- The function is called with two arguments. The first argument is a +--- `String` and is the `:find` command argument. The second argument is +--- a `Boolean` and is set to `v:true` when the function is called to get +--- a List of command-line completion matches for the `:find` command. +--- The function should return a List of strings. --- ---- The expression may be evaluated for command-line completion as well, ---- in which case the `v:cmdcomplete` variable will be set to `v:true`, ---- otherwise it will be set to `v:false`. +--- The function is called only once per `:find` command invocation. +--- The function can process all the directories specified in 'path'. --- ---- If a match is found, the expression should return a `List` containing ---- one or more file names. If a match is not found, the expression +--- If a match is found, the function should return a `List` containing +--- one or more file names. If a match is not found, the function --- should return an empty List. --- ---- If any errors are encountered during the expression evaluation, an +--- If any errors are encountered during the function invocation, an --- empty List is used as the return value. --- ---- Using a function call without arguments is faster `expr-option-function` ---- --- It is not allowed to change text or jump to another window while ---- evaluating 'findexpr' `textlock`. +--- executing the 'findfunc' `textlock`. --- --- This option cannot be set from a `modeline` or in the `sandbox`, for --- security reasons. @@ -2327,28 +2327,28 @@ vim.go.fcs = vim.go.fillchars --- --- ```vim --- " Use glob() ---- func FindExprGlob() ---- let pat = v:cmdcomplete ? $'{v:fname}*' : v:fname +--- func FindFuncGlob(cmdarg, cmdcomplete) +--- let pat = a:cmdcomplete ? $'{a:cmdarg}*' : a:cmdarg --- return glob(pat, v:false, v:true) --- endfunc ---- set findexpr=FindExprGlob() +--- set findfunc=FindFuncGlob --- --- " Use the 'git ls-files' output ---- func FindGitFiles() +--- func FindGitFiles(cmdarg, cmdcomplete) --- let fnames = systemlist('git ls-files') ---- return fnames->filter('v:val =~? v:fname') +--- return fnames->filter('v:val =~? a:cmdarg') --- endfunc ---- set findexpr=FindGitFiles() +--- set findfunc=FindGitFiles --- ``` --- --- --- @type string -vim.o.findexpr = "" -vim.o.fexpr = vim.o.findexpr -vim.bo.findexpr = vim.o.findexpr -vim.bo.fexpr = vim.bo.findexpr -vim.go.findexpr = vim.o.findexpr -vim.go.fexpr = vim.go.findexpr +vim.o.findfunc = "" +vim.o.ffu = vim.o.findfunc +vim.bo.findfunc = vim.o.findfunc +vim.bo.ffu = vim.bo.findfunc +vim.go.findfunc = vim.o.findfunc +vim.go.ffu = vim.go.findfunc --- When writing a file and this option is on, at the end of file --- will be restored if missing. Turn this option off if you want to diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index b104356334..e00402ab3f 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -44,11 +44,6 @@ vim.v.cmdarg = ... --- @type integer vim.v.cmdbang = ... ---- When evaluating 'findexpr': if 'findexpr' is used for cmdline ---- completion the value is `v:true`, otherwise it is `v:false`. ---- @type boolean -vim.v.cmdcomplete = ... - --- The current locale setting for collation order of the runtime --- environment. This allows Vim scripts to be aware of the --- current locale encoding. Technical: it's the value of @@ -272,8 +267,7 @@ vim.v.fcs_choice = ... vim.v.fcs_reason = ... --- When evaluating 'includeexpr': the file name that was ---- detected. When evaluating 'findexpr': the argument passed to ---- the `:find` command. Empty otherwise. +--- detected. Empty otherwise. --- @type string vim.v.fname = ... -- cgit From a27419f3fc540f66567f4559a796cd6758f1bb1f Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Mon, 4 Nov 2024 19:00:12 +0600 Subject: feat(options)!: disallow setting hidden options #28400 Problem: There are three different ways of marking an option as hidden, `enable_if = false`, `hidden = true` and `immutable = true`. These also have different behaviors. Options hidden with `enable_if = false` can't have their value fetched using Vim script or the API, but options hidden with `hidden = true` or `immutable = true` can. On the other hand, options with `hidden = true` do not error when trying to set their value, but options with `immutable = true` do. Solution: Remove `enable_if = false`, remove the `hidden` property for options, and use `immutable = true` to mark an option as hidden instead. Also make hidden option variable pointers always point to the default value, which allows fetching the value of every hidden option using Vim script and the API. This does also mean that trying to set a hidden option will now give an error instead of just being ignored. --- runtime/lua/vim/_meta/options.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index f9886957a7..45ab14a774 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -1106,7 +1106,7 @@ vim.bo.cot = vim.bo.completeopt vim.go.completeopt = vim.o.completeopt vim.go.cot = vim.go.completeopt ---- only for MS-Windows +--- only modifiable in MS-Windows --- When this option is set it overrules 'shellslash' for completion: --- - When this option is set to "slash", a forward slash is used for path --- completion in insert mode. This is useful when editing HTML tag, or @@ -5547,7 +5547,7 @@ vim.o.srr = vim.o.shellredir vim.go.shellredir = vim.o.shellredir vim.go.srr = vim.go.shellredir ---- only for MS-Windows +--- only modifiable in MS-Windows --- When set, a forward slash is used when expanding file names. This is --- useful when a Unix-like shell is used instead of cmd.exe. Backward --- slashes can still be typed, but they are changed to forward slashes by @@ -5564,7 +5564,7 @@ vim.go.srr = vim.go.shellredir --- Also see 'completeslash'. --- --- @type boolean -vim.o.shellslash = false +vim.o.shellslash = true vim.o.ssl = vim.o.shellslash vim.go.shellslash = vim.o.shellslash vim.go.ssl = vim.go.shellslash -- cgit From 5a27d02584656f35d757c01f10a1d3c88910c519 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 9 Nov 2024 01:10:56 +0100 Subject: docs: misc (#30914) Co-authored-by: Ernie Rael Co-authored-by: Famiu Haque Co-authored-by: Jade Co-authored-by: glepnir Co-authored-by: zeertzjq --- runtime/lua/vim/_meta/api.lua | 4 ++-- runtime/lua/vim/_meta/vimfn.lua | 6 +++--- runtime/lua/vim/_meta/vvars.lua | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 8236cc7cf0..c28af7bbff 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1110,8 +1110,8 @@ function vim.api.nvim_del_var(name) end --- can be omitted for no highlight. --- @param history boolean if true, add to `message-history`. --- @param opts vim.api.keyset.echo_opts Optional parameters. ---- - verbose: Message was printed as a result of 'verbose' option ---- if Nvim was invoked with -V3log_file, the message will be +--- - verbose: Message is printed as a result of 'verbose' option. +--- If Nvim was invoked with -V3log_file, the message will be --- redirected to the log_file and suppressed from direct output. function vim.api.nvim_echo(chunks, history, opts) end diff --git a/runtime/lua/vim/_meta/vimfn.lua b/runtime/lua/vim/_meta/vimfn.lua index 7548d1beb2..5eb15e1eee 100644 --- a/runtime/lua/vim/_meta/vimfn.lua +++ b/runtime/lua/vim/_meta/vimfn.lua @@ -828,7 +828,7 @@ function vim.fn.charclass(string) end --- echo col('.') " returns 7 --- < --- ---- @param expr string|integer[] +--- @param expr string|any[] --- @param winid? integer --- @return integer function vim.fn.charcol(expr, winid) end @@ -956,7 +956,7 @@ function vim.fn.clearmatches(win) end --- imap echo col(".").."\n" --- < --- ---- @param expr string|integer[] +--- @param expr string|any[] --- @param winid? integer --- @return integer function vim.fn.col(expr, winid) end @@ -10546,7 +10546,7 @@ function vim.fn.values(dict) end --- echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) --- < --- ---- @param expr string|integer[] +--- @param expr string|any[] --- @param list? boolean --- @param winid? integer --- @return any diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index e00402ab3f..733aa965a2 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -166,7 +166,7 @@ vim.v.errors = ... --- inclusive Motion is `inclusive`, else exclusive. --- scope Event-specific scope name. --- operator Current `operator`. Also set for Ex ---- commands (unlike `v:operator`). For +--- commands (unlike `v:operator`). For --- example if `TextYankPost` is triggered --- by the `:yank` Ex command then --- `v:event.operator` is "y". -- cgit From de48fbbd5f8800bd7f1909a6fb41e53e871cf74c Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Thu, 20 Jun 2024 14:48:06 +0200 Subject: fix(messages)!: vim.ui_attach message callbacks are unsafe Problem: Lua callbacks for "msg_show" events with vim.ui_attach() are executed when it is not safe. Solution: Disallow non-fast API calls for "msg_show" event callbacks. Automatically detach callback after excessive errors. Make sure fast APIs do not modify Nvim state. --- runtime/lua/vim/_meta/builtin.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index 234c75d38f..dd6ef69eb8 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -233,6 +233,10 @@ function vim.wait(time, callback, interval, fast_only) end --- {callback} receives event name plus additional parameters. See |ui-popupmenu| --- and the sections below for event format for respective events. --- +--- Callbacks for `msg_show` events are executed in |api-fast| context. +--- +--- Excessive errors inside the callback will result in forced detachment. +--- --- WARNING: This api is considered experimental. Usability will vary for --- different screen elements. In particular `ext_messages` behavior is subject --- to further changes and usability improvements. This is expected to be -- cgit From fa0dcde3d9f17f85baa9dd41aa751c123281ced3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 15 Nov 2024 08:04:49 +0800 Subject: vim-patch:9.1.0864: message history is fixed to 200 (#31215) Problem: message history is fixed to 200 Solution: Add the 'msghistory' option, increase the default value to 500 (Shougo Matsushita) closes: vim/vim#16048 https://github.com/vim/vim/commit/4bd9b2b2467e696061104a029000e9824c6c609e Co-authored-by: Shougo Matsushita Co-authored-by: Milly --- runtime/lua/vim/_meta/options.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/options.lua b/runtime/lua/vim/_meta/options.lua index 45ab14a774..cb783720ac 100644 --- a/runtime/lua/vim/_meta/options.lua +++ b/runtime/lua/vim/_meta/options.lua @@ -3016,7 +3016,8 @@ vim.go.hid = vim.go.hidden --- A history of ":" commands, and a history of previous search patterns --- is remembered. This option decides how many entries may be stored in ---- each of these histories (see `cmdline-editing`). +--- each of these histories (see `cmdline-editing` and 'msghistory' for +--- the number of messages to remember). --- The maximum value is 10000. --- --- @type integer @@ -4378,6 +4379,15 @@ vim.o.mouset = vim.o.mousetime vim.go.mousetime = vim.o.mousetime vim.go.mouset = vim.go.mousetime +--- Determines how many entries are remembered in the `:messages` history. +--- The maximum value is 10000. +--- +--- @type integer +vim.o.msghistory = 500 +vim.o.mhi = vim.o.msghistory +vim.go.msghistory = vim.o.msghistory +vim.go.mhi = vim.go.msghistory + --- This defines what bases Vim will consider for numbers when using the --- CTRL-A and CTRL-X commands for adding to and subtracting from a number --- respectively; see `CTRL-A` for more info on these commands. -- cgit From 6e4df18b457e9743c34068fd6e0a89fd04d3526c Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Fri, 15 Nov 2024 23:34:42 +0100 Subject: fix(ui): no fast context for prompt message kinds #31224 Problem: No longer able to show prompt messages with vim.ui_attach(). Solution: Do not execute callback in fast context for prompt message kinds. These events must be safe to show the incoming message so the event itself serves to indicate that the message should be shown immediately. --- runtime/lua/vim/_meta/builtin.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/builtin.lua b/runtime/lua/vim/_meta/builtin.lua index dd6ef69eb8..b8779b66fe 100644 --- a/runtime/lua/vim/_meta/builtin.lua +++ b/runtime/lua/vim/_meta/builtin.lua @@ -233,7 +233,9 @@ function vim.wait(time, callback, interval, fast_only) end --- {callback} receives event name plus additional parameters. See |ui-popupmenu| --- and the sections below for event format for respective events. --- ---- Callbacks for `msg_show` events are executed in |api-fast| context. +--- Callbacks for `msg_show` events are executed in |api-fast| context unless +--- Nvim will wait for input, in which case messages should be shown +--- immediately. --- --- Excessive errors inside the callback will result in forced detachment. --- -- cgit From 2f7b0018b0354447497e8496fa3745773df2f218 Mon Sep 17 00:00:00 2001 From: errael Date: Fri, 15 Nov 2024 17:37:36 -0800 Subject: docs: standardize doc for ChanInfo/ChanOpen autocmds/v:event (#31099) --- runtime/lua/vim/_meta/vvars.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/vvars.lua b/runtime/lua/vim/_meta/vvars.lua index 733aa965a2..8784fdbac9 100644 --- a/runtime/lua/vim/_meta/vvars.lua +++ b/runtime/lua/vim/_meta/vvars.lua @@ -160,6 +160,7 @@ vim.v.errors = ... --- an aborting condition (e.g. `c_Esc` or --- `c_CTRL-C` for `CmdlineLeave`). --- chan `channel-id` +--- info Dict of arbitrary event data. --- cmdlevel Level of cmdline. --- cmdtype Type of cmdline, `cmdline-char`. --- cwd Current working directory. -- cgit From f85bc41c800d7f5c0256f29aa347a53600a7c8d5 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 17 Nov 2024 00:32:36 +0100 Subject: feat(ui): don't show unfocusable windows in :tabs, 'tabline' #27984 Problem: Floating windows with focusable set to false can reasonably be expected to be UI elements but are listed in some outputs that should contain only regular windows. Solution: Hide unfocusable floating windows from the default tabline and :tabs. --- runtime/lua/vim/_meta/api.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index c28af7bbff..30654efdea 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -1768,7 +1768,7 @@ function vim.api.nvim_open_term(buffer, opts) end --- - focusable: Enable focus by user actions (wincmds, mouse events). --- Defaults to true. Non-focusable windows can be entered by --- `nvim_set_current_win()`, or, when the `mouse` field is set to true, ---- by mouse events. +--- by mouse events. See `focusable`. --- - mouse: Specify how this window interacts with mouse events. --- Defaults to `focusable` value. --- - If false, mouse events pass through this window. -- cgit From 9c718bc2bce53b5be45061bff940f99e50c8bfcb Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 17 Nov 2024 00:36:11 +0100 Subject: fix(api): validation, documentation of hl_group #31195 Problem: Documentation for "hl_group" in nvim_buf_set_extmark() is unclear. "hl_group" in nvim_echo() does not accept highlight group id. Solution: Move documentation for highlight group name/id to first mention of hl_group. Update nvim_echo() to accept highlight group id. --- runtime/lua/vim/_meta/api.lua | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'runtime/lua/vim/_meta') diff --git a/runtime/lua/vim/_meta/api.lua b/runtime/lua/vim/_meta/api.lua index 30654efdea..3c9b9d4f44 100644 --- a/runtime/lua/vim/_meta/api.lua +++ b/runtime/lua/vim/_meta/api.lua @@ -592,8 +592,9 @@ function vim.api.nvim_buf_line_count(buffer) end --- - id : id of the extmark to edit. --- - end_row : ending line of the mark, 0-based inclusive. --- - end_col : ending col of the mark, 0-based exclusive. ---- - hl_group : name of the highlight group used to highlight ---- this mark. +--- - hl_group : highlight group used for the text range. This and below +--- highlight groups can be supplied either as a string or as an integer, +--- the latter of which can be obtained using `nvim_get_hl_id_by_name()`. --- - hl_eol : when true, for a multiline highlight covering the --- EOL of a line, continue the highlight for the rest --- of the screen line (just like for diff and @@ -603,9 +604,7 @@ function vim.api.nvim_buf_line_count(buffer) end --- text chunk with specified highlight. `highlight` element --- can either be a single highlight group, or an array of --- multiple highlight groups that will be stacked ---- (highest priority last). A highlight group can be supplied ---- either as a string or as an integer, the latter which ---- can be obtained using `nvim_get_hl_id_by_name()`. +--- (highest priority last). --- - virt_text_pos : position of virtual text. Possible values: --- - "eol": right after eol character (default). --- - "overlay": display over the specified column, without @@ -676,15 +675,12 @@ function vim.api.nvim_buf_line_count(buffer) end --- buffer or end of the line respectively. Defaults to true. --- - sign_text: string of length 1-2 used to display in the --- sign column. ---- - sign_hl_group: name of the highlight group used to ---- highlight the sign column text. ---- - number_hl_group: name of the highlight group used to ---- highlight the number column. ---- - line_hl_group: name of the highlight group used to ---- highlight the whole line. ---- - cursorline_hl_group: name of the highlight group used to ---- highlight the sign column text when the cursor is on ---- the same line as the mark and 'cursorline' is enabled. +--- - sign_hl_group: highlight group used for the sign column text. +--- - number_hl_group: highlight group used for the number column. +--- - line_hl_group: highlight group used for the whole line. +--- - cursorline_hl_group: highlight group used for the sign +--- column text when the cursor is on the same line as the +--- mark and 'cursorline' is enabled. --- - conceal: string which should be either empty or a single --- character. Enable concealing similar to `:syn-conceal`. --- When a character is supplied it is used as `:syn-cchar`. @@ -1106,8 +1102,8 @@ function vim.api.nvim_del_var(name) end --- Echo a message. --- --- @param chunks any[] A list of `[text, hl_group]` arrays, each representing a ---- text chunk with specified highlight. `hl_group` element ---- can be omitted for no highlight. +--- text chunk with specified highlight group name or ID. +--- `hl_group` element can be omitted for no highlight. --- @param history boolean if true, add to `message-history`. --- @param opts vim.api.keyset.echo_opts Optional parameters. --- - verbose: Message is printed as a result of 'verbose' option. -- cgit