docs(lua): reference runtime/lua/vim/_editor.lua

This commit is contained in:
zeertzjq 2022-03-06 21:16:21 +08:00
parent 8ed9c84481
commit 80e6f81862
4 changed files with 17 additions and 8 deletions

View File

@ -204,7 +204,7 @@ Docstring format:
- Use `<pre>` for code samples. - Use `<pre>` for code samples.
Example: the help for |vim.paste()| is generated from a docstring decorating Example: the help for |vim.paste()| is generated from a docstring decorating
vim.paste in src/nvim/lua/vim.lua like this: > vim.paste in runtime/lua/vim/_editor.lua like this: >
--- Paste handler, invoked by |nvim_paste()| when a conforming UI --- Paste handler, invoked by |nvim_paste()| when a conforming UI
--- (such as the |TUI|) pastes text into the editor. --- (such as the |TUI|) pastes text into the editor.

View File

@ -5,7 +5,7 @@
-- `inspect` and `lpeg` modules. -- `inspect` and `lpeg` modules.
-- 2. runtime/lua/vim/shared.lua: Code shared between Nvim and tests. -- 2. runtime/lua/vim/shared.lua: Code shared between Nvim and tests.
-- (This will go away if we migrate to nvim as the test-runner.) -- (This will go away if we migrate to nvim as the test-runner.)
-- 3. src/nvim/lua/: Compiled-into Nvim itself. -- 3. runtime/lua/vim/_editor.lua: Compiled-into Nvim itself.
-- --
-- Guideline: "If in doubt, put it in the runtime". -- Guideline: "If in doubt, put it in the runtime".
-- --

View File

@ -2,7 +2,7 @@
-- --
-- The singular purpose of this module is to share code with the Nvim -- The singular purpose of this module is to share code with the Nvim
-- test-suite. If, in the future, Nvim itself is used to run the test-suite -- test-suite. If, in the future, Nvim itself is used to run the test-suite
-- instead of "vanilla Lua", these functions could move to src/nvim/lua/vim.lua -- instead of "vanilla Lua", these functions could move to runtime/lua/vim/_editor.lua
local vim = vim or {} local vim = vim or {}

View File

@ -124,7 +124,7 @@ CONFIG = {
'filename': 'lua.txt', 'filename': 'lua.txt',
'section_start_token': '*lua-vim*', 'section_start_token': '*lua-vim*',
'section_order': [ 'section_order': [
'vim.lua', '_editor.lua',
'shared.lua', 'shared.lua',
'uri.lua', 'uri.lua',
'ui.lua', 'ui.lua',
@ -132,7 +132,7 @@ CONFIG = {
'keymap.lua', 'keymap.lua',
], ],
'files': ' '.join([ 'files': ' '.join([
os.path.join(base_dir, 'src/nvim/lua/vim.lua'), os.path.join(base_dir, 'runtime/lua/vim/_editor.lua'),
os.path.join(base_dir, 'runtime/lua/vim/shared.lua'), os.path.join(base_dir, 'runtime/lua/vim/shared.lua'),
os.path.join(base_dir, 'runtime/lua/vim/uri.lua'), os.path.join(base_dir, 'runtime/lua/vim/uri.lua'),
os.path.join(base_dir, 'runtime/lua/vim/ui.lua'), os.path.join(base_dir, 'runtime/lua/vim/ui.lua'),
@ -144,9 +144,18 @@ CONFIG = {
'section_name': { 'section_name': {
'lsp.lua': 'core', 'lsp.lua': 'core',
}, },
'section_fmt': lambda name: f'Lua module: {name.lower()}', 'section_fmt': lambda name: (
'helptag_fmt': lambda name: f'*lua-{name.lower()}*', 'Lua module: vim'
'fn_helptag_fmt': lambda fstem, name: f'*{fstem}.{name}()*', if name.lower() == '_editor'
else f'Lua module: {name.lower()}'),
'helptag_fmt': lambda name: (
'*lua-vim*'
if name.lower() == '_editor'
else f'*lua-{name.lower()}*'),
'fn_helptag_fmt': lambda fstem, name: (
f'*vim.{name}()*'
if fstem.lower() == '_editor'
else f'*{fstem}.{name}()*'),
'module_override': { 'module_override': {
# `shared` functions are exposed on the `vim` module. # `shared` functions are exposed on the `vim` module.
'shared': 'vim', 'shared': 'vim',