mirror of
https://github.com/neovim/neovim.git
synced 2025-10-01 23:48:32 +00:00
Merge pull request #21154 from clason/vimdoc-injections
feat(help): highlighted codeblocks
This commit is contained in:
@@ -47,7 +47,7 @@ static int64_t next_autocmd_id = 1;
|
||||
/// Get all autocommands that match the corresponding {opts}.
|
||||
///
|
||||
/// These examples will get autocommands matching ALL the given criteria:
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// -- Matches all criteria
|
||||
/// autocommands = vim.api.nvim_get_autocmds({
|
||||
/// group = "MyGroup",
|
||||
@@ -367,7 +367,7 @@ cleanup:
|
||||
/// triggers: a callback function (Lua or Vimscript), or a command (like regular autocommands).
|
||||
///
|
||||
/// Example using callback:
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// -- Lua function
|
||||
/// local myluafun = function() print("This buffer enters") end
|
||||
///
|
||||
@@ -383,8 +383,7 @@ cleanup:
|
||||
/// Lua functions receive a table with information about the autocmd event as an argument. To use
|
||||
/// a function which itself accepts another (optional) parameter, wrap the function
|
||||
/// in a lambda:
|
||||
///
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// -- Lua function with an optional parameter.
|
||||
/// -- The autocmd callback would pass a table as argument but this
|
||||
/// -- function expects number|nil
|
||||
@@ -397,7 +396,7 @@ cleanup:
|
||||
/// </pre>
|
||||
///
|
||||
/// Example using command:
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
|
||||
/// pattern = {"*.c", "*.h"},
|
||||
/// command = "echo 'Entering a C or C++ file'",
|
||||
@@ -405,7 +404,7 @@ cleanup:
|
||||
/// </pre>
|
||||
///
|
||||
/// Example values for pattern:
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// pattern = "*.py"
|
||||
/// pattern = { "*.py", "*.pyi" }
|
||||
/// </pre>
|
||||
@@ -413,14 +412,14 @@ cleanup:
|
||||
/// Note: The `pattern` is passed to callbacks and commands as a literal string; environment
|
||||
/// variables like `$HOME` and `~` are not automatically expanded as they are by |:autocmd|.
|
||||
/// Instead, |expand()| such variables explicitly:
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// pattern = vim.fn.expand("~") .. "/some/path/*.py"
|
||||
/// </pre>
|
||||
///
|
||||
/// Example values for event:
|
||||
/// <pre>
|
||||
/// "BufWritePre"
|
||||
/// {"CursorHold", "BufWritePre", "BufWritePost"}
|
||||
/// <pre>lua
|
||||
/// event = "BufWritePre"
|
||||
/// event = {"CursorHold", "BufWritePre", "BufWritePost"}
|
||||
/// </pre>
|
||||
///
|
||||
/// @param event (string|array) The event or events to register this autocommand
|
||||
@@ -703,7 +702,7 @@ cleanup:
|
||||
/// Create or get an autocommand group |autocmd-groups|.
|
||||
///
|
||||
/// To get an existing group id, do:
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// local id = vim.api.nvim_create_augroup("MyGroup", {
|
||||
/// clear = false
|
||||
/// })
|
||||
|
@@ -84,7 +84,7 @@ Integer nvim_buf_line_count(Buffer buffer, Error *err)
|
||||
///
|
||||
/// Example (Lua): capture buffer updates in a global `events` variable
|
||||
/// (use "print(vim.inspect(events))" to see its contents):
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// events = {}
|
||||
/// vim.api.nvim_buf_attach(0, false, {
|
||||
/// on_lines=function(...) table.insert(events, {...}) end})
|
||||
|
@@ -889,7 +889,7 @@ static void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdin
|
||||
/// {command} is the replacement text or Lua function to execute.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// <pre>vim
|
||||
/// :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {})
|
||||
/// :SayHello
|
||||
/// Hello world!
|
||||
|
@@ -255,8 +255,7 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
|
||||
/// Region can be given as (row,col) tuples, or valid extmark ids (whose
|
||||
/// positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
|
||||
/// respectively, thus the following are equivalent:
|
||||
///
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
|
||||
/// nvim_buf_get_extmarks(0, my_ns, [0,0], [-1,-1], {})
|
||||
/// </pre>
|
||||
@@ -265,8 +264,7 @@ ArrayOf(Integer) nvim_buf_get_extmark_by_id(Buffer buffer, Integer ns_id,
|
||||
/// with `limit`, to get the first marks prior to a given position.)
|
||||
///
|
||||
/// Example:
|
||||
///
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// local a = vim.api
|
||||
/// local pos = a.nvim_win_get_cursor(0)
|
||||
/// local ns = a.nvim_create_namespace('my-plugin')
|
||||
|
@@ -229,7 +229,7 @@ void nvim_set_hl_ns_fast(Integer ns_id, Error *err)
|
||||
/// nvim_feedkeys().
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// <pre>vim
|
||||
/// :let key = nvim_replace_termcodes("<C-o>", v:true, v:false, v:true)
|
||||
/// :call nvim_feedkeys(key, 'n', v:false)
|
||||
/// </pre>
|
||||
@@ -1295,7 +1295,7 @@ void nvim_unsubscribe(uint64_t channel_id, String event)
|
||||
/// "#rrggbb" hexadecimal string.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// <pre>vim
|
||||
/// :echo nvim_get_color_by_name("Pink")
|
||||
/// :echo nvim_get_color_by_name("#cbcbcb")
|
||||
/// </pre>
|
||||
@@ -1437,12 +1437,12 @@ ArrayOf(Dictionary) nvim_get_keymap(String mode)
|
||||
/// Empty {rhs} is |<Nop>|. |keycodes| are replaced as usual.
|
||||
///
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// <pre>vim
|
||||
/// call nvim_set_keymap('n', ' <NL>', '', {'nowait': v:true})
|
||||
/// </pre>
|
||||
///
|
||||
/// is equivalent to:
|
||||
/// <pre>
|
||||
/// <pre>vim
|
||||
/// nmap <nowait> <Space><NL> <Nop>
|
||||
/// </pre>
|
||||
///
|
||||
|
@@ -55,13 +55,13 @@
|
||||
/// this should not be used to specify arbitrary WM screen positions.
|
||||
///
|
||||
/// Example (Lua): window-relative float
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// vim.api.nvim_open_win(0, false,
|
||||
/// {relative='win', row=3, col=3, width=12, height=3})
|
||||
/// </pre>
|
||||
///
|
||||
/// Example (Lua): buffer-relative float (travels as buffer is scrolled)
|
||||
/// <pre>
|
||||
/// <pre>lua
|
||||
/// vim.api.nvim_open_win(0, false,
|
||||
/// {relative='win', width=12, height=3, bufpos={100,10}})
|
||||
/// </pre>
|
||||
|
Reference in New Issue
Block a user