aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/api/autocmd.c21
-rw-r--r--src/nvim/api/buffer.c2
-rw-r--r--src/nvim/api/command.c2
-rw-r--r--src/nvim/api/extmark.c6
-rw-r--r--src/nvim/api/vim.c8
-rw-r--r--src/nvim/api/win_config.c4
6 files changed, 20 insertions, 23 deletions
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index af185c50c9..db84ecb5d8 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -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
/// })
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 0a31286df7..fe9e6077d6 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -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})
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index 8a7abf0845..416dbc0e5d 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -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!
diff --git a/src/nvim/api/extmark.c b/src/nvim/api/extmark.c
index 3a96c42dba..b406672aa5 100644
--- a/src/nvim/api/extmark.c
+++ b/src/nvim/api/extmark.c
@@ -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')
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index c3f71cc625..857c03eb27 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -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>
///
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index cfe887d762..828ef2f0eb 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -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>