aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorかわえもん <me@kawaemon.dev>2022-03-26 21:21:32 +0900
committerGitHub <noreply@github.com>2022-03-26 13:21:32 +0100
commit85821d8b6fa366f7361f84e07e62dc8fc951f26d (patch)
treec7deab6af2c7f5c426e5abd1032856cc1f5b2aa5
parentfb5587d2bede0cc091b92731b990bd2e394e9914 (diff)
downloadrneovim-85821d8b6fa366f7361f84e07e62dc8fc951f26d.tar.gz
rneovim-85821d8b6fa366f7361f84e07e62dc8fc951f26d.tar.bz2
rneovim-85821d8b6fa366f7361f84e07e62dc8fc951f26d.zip
docs(api): fix wrong documentation of `nvim_create_autocmd` (#17870)
also add doc changes from typofix PR
-rw-r--r--runtime/doc/api.txt18
-rw-r--r--src/nvim/api/autocmd.c10
2 files changed, 12 insertions, 16 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index d912b22197..02a27e15f8 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -1802,7 +1802,7 @@ nvim_parse_expression({expr}, {flags}, {highlight})
there for debugging purposes primary (debugging
parser and providing debug information).
• "children": a list of nodes described in top/"ast".
- There is always zero, one or two children, key will
+ There always is zero, one or two children, key will
not be present if node has no children. Maximum
number of children may be found in node_maxchildren
array.
@@ -1967,7 +1967,7 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
current window already shows "buffer", the window is not
switched If a window inside the current tabpage (including a
float) already shows the buffer One of these windows will be
- set as current window temporarily. Otherwise, a temporary
+ set as current window temporarily. Otherwise a temporary
scratch window (called the "autocmd window" for historical
reasons) will be used.
@@ -2362,7 +2362,7 @@ nvim_buf_add_highlight({buffer}, {ns_id}, {hl_group}, {line}, {col_start},
it in to this function as `ns_id` to add highlights to the
namespace. All highlights in the same namespace can then be
cleared with single call to |nvim_buf_clear_namespace()|. If
- the highlight will never be deleted by an API call, pass
+ the highlight never will be deleted by an API call, pass
`ns_id = -1`.
As a shorthand, `ns_id = 0` can be used to create a new
@@ -3029,7 +3029,7 @@ nvim_open_win({buffer}, {enter}, {*config}) *nvim_open_win()*
double box style could be specified as [
"╔", "═" ,"╗", "║", "╝", "═", "╚", "║" ]. If
the number of chars are less than eight,
- they will be repeated. Thus, an ASCII border
+ they will be repeated. Thus an ASCII border
could be specified as [ "/", "-", "\\", "|"
], or all chars the same as [ "x" ]. An
empty string can be used to turn off a
@@ -3188,16 +3188,14 @@ nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
-- Vimscript function name (as a string)
local myvimfun = "g:MyVimFunction"
- vim.api.nvim_create_autocmd({
- event = {"BufEnter", "BufWinEnter"},
+ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.c", "*.h"},
callback = myluafun, -- Or myvimfun
})
<
Example using command: >
- vim.api.nvim_create_autocmd({
- event = {"BufEnter", "BufWinEnter"},
+ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
pattern = {"*.c", "*.h"},
command = "echo 'Entering a C or C++ file'",
})
@@ -3209,8 +3207,8 @@ nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()*
<
Examples values for event: >
- event = "BufPreWrite"
- event = {"CursorHold", "BufPreWrite", "BufPostWrite"}
+ "BufPreWrite"
+ {"CursorHold", "BufPreWrite", "BufPostWrite"}
<
Parameters: ~
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index 94a24705d0..9aaa0418dc 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -340,8 +340,7 @@ cleanup:
/// -- Vimscript function name (as a string)
/// local myvimfun = "g:MyVimFunction"
///
-/// vim.api.nvim_create_autocmd({
-/// event = {"BufEnter", "BufWinEnter"},
+/// vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
/// pattern = {"*.c", "*.h"},
/// callback = myluafun, -- Or myvimfun
/// })
@@ -349,8 +348,7 @@ cleanup:
///
/// Example using command:
/// <pre>
-/// vim.api.nvim_create_autocmd({
-/// event = {"BufEnter", "BufWinEnter"},
+/// vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
/// pattern = {"*.c", "*.h"},
/// command = "echo 'Entering a C or C++ file'",
/// })
@@ -364,8 +362,8 @@ cleanup:
///
/// Examples values for event:
/// <pre>
-/// event = "BufPreWrite"
-/// event = {"CursorHold", "BufPreWrite", "BufPostWrite"}
+/// "BufPreWrite"
+/// {"CursorHold", "BufPreWrite", "BufPostWrite"}
/// </pre>
///
/// @param event (String|Array) The event or events to register this autocommand