aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-04-10 20:46:02 -0600
committerGitHub <noreply@github.com>2022-04-10 20:46:02 -0600
commitcdfb045ea027e018f14fb2735c3fd6aaa718ae58 (patch)
treebf4c2e4ade24d58711e45743cc4db35ac377d144 /runtime
parenta2f157233f274599739941e39673ca4d3b0291c3 (diff)
parent379067d0386083b3f9531062d9f3a83a24bff745 (diff)
downloadrneovim-cdfb045ea027e018f14fb2735c3fd6aaa718ae58.tar.gz
rneovim-cdfb045ea027e018f14fb2735c3fd6aaa718ae58.tar.bz2
rneovim-cdfb045ea027e018f14fb2735c3fd6aaa718ae58.zip
Merge pull request #18071 from gpanders/create_uc
refactor!: Rename nvim_add_user_command to nvim_create_user_command
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/api.txt134
-rw-r--r--runtime/doc/develop.txt13
2 files changed, 74 insertions, 73 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 095f74b65d..858258320d 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -627,62 +627,6 @@ nvim__stats() *nvim__stats()*
Return: ~
Map of various internal stats.
- *nvim_add_user_command()*
-nvim_add_user_command({name}, {command}, {*opts})
- Create a new user command |user-commands|
-
- {name} is the name of the new command. The name must begin
- with an uppercase letter.
-
- {command} is the replacement text or Lua function to execute.
-
- Example: >
- :call nvim_add_user_command('SayHello', 'echo "Hello world!"', {})
- :SayHello
- Hello world!
-<
-
- Parameters: ~
- {name} Name of the new user command. Must begin with
- an uppercase letter.
- {command} Replacement command to execute when this user
- command is executed. When called from Lua, the
- command can also be a Lua function. The
- function is called with a single table argument
- that contains the following keys:
- • args: (string) The args passed to the
- command, if any |<args>|
- • fargs: (table) The args split by unescaped
- whitespace (when more than one argument is
- allowed), if any |<f-args>|
- • bang: (boolean) "true" if the command was
- executed with a ! modifier |<bang>|
- • line1: (number) The starting line of the
- command range |<line1>|
- • line2: (number) The final line of the command
- range |<line2>|
- • range: (number) The number of items in the
- command range: 0, 1, or 2 |<range>|
- • count: (number) Any count supplied |<count>|
- • reg: (string) The optional register, if
- specified |<reg>|
- • mods: (string) Command modifiers, if any
- |<mods>|
- {opts} Optional command attributes. See
- |command-attributes| for more details. To use
- boolean attributes (such as |:command-bang| or
- |:command-bar|) set the value to "true". In
- addition to the string options listed in
- |:command-complete|, the "complete" key also
- accepts a Lua function which works like the
- "customlist" completion mode
- |:command-completion-customlist|. Additional
- parameters:
- • desc: (string) Used for listing the command
- when a Lua function is used for {command}.
- • force: (boolean, default true) Override any
- previous definition.
-
nvim_call_atomic({calls}) *nvim_call_atomic()*
Calls many API methods atomically.
@@ -740,6 +684,62 @@ nvim_create_buf({listed}, {scratch}) *nvim_create_buf()*
See also: ~
buf_open_scratch
+ *nvim_create_user_command()*
+nvim_create_user_command({name}, {command}, {*opts})
+ Create a new user command |user-commands|
+
+ {name} is the name of the new command. The name must begin
+ with an uppercase letter.
+
+ {command} is the replacement text or Lua function to execute.
+
+ Example: >
+ :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {})
+ :SayHello
+ Hello world!
+<
+
+ Parameters: ~
+ {name} Name of the new user command. Must begin with
+ an uppercase letter.
+ {command} Replacement command to execute when this user
+ command is executed. When called from Lua, the
+ command can also be a Lua function. The
+ function is called with a single table argument
+ that contains the following keys:
+ • args: (string) The args passed to the
+ command, if any |<args>|
+ • fargs: (table) The args split by unescaped
+ whitespace (when more than one argument is
+ allowed), if any |<f-args>|
+ • bang: (boolean) "true" if the command was
+ executed with a ! modifier |<bang>|
+ • line1: (number) The starting line of the
+ command range |<line1>|
+ • line2: (number) The final line of the command
+ range |<line2>|
+ • range: (number) The number of items in the
+ command range: 0, 1, or 2 |<range>|
+ • count: (number) Any count supplied |<count>|
+ • reg: (string) The optional register, if
+ specified |<reg>|
+ • mods: (string) Command modifiers, if any
+ |<mods>|
+ {opts} Optional command attributes. See
+ |command-attributes| for more details. To use
+ boolean attributes (such as |:command-bang| or
+ |:command-bar|) set the value to "true". In
+ addition to the string options listed in
+ |:command-complete|, the "complete" key also
+ accepts a Lua function which works like the
+ "customlist" completion mode
+ |:command-completion-customlist|. Additional
+ parameters:
+ • desc: (string) Used for listing the command
+ when a Lua function is used for {command}.
+ • force: (boolean, default true) Override any
+ previous definition.
+
nvim_del_current_line() *nvim_del_current_line()*
Deletes the current line.
@@ -1864,16 +1864,6 @@ nvim__buf_redraw_range({buffer}, {first}, {last})
nvim__buf_stats({buffer}) *nvim__buf_stats()*
TODO: Documentation
- *nvim_buf_add_user_command()*
-nvim_buf_add_user_command({buffer}, {name}, {command}, {*opts})
- Create a new user command |user-commands| in the given buffer.
-
- Parameters: ~
- {buffer} Buffer handle, or 0 for current buffer.
-
- See also: ~
- nvim_add_user_command
-
nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
Activates buffer-update events on a channel, or as Lua
callbacks.
@@ -1983,6 +1973,16 @@ nvim_buf_call({buffer}, {fun}) *nvim_buf_call()*
Return value of function. NB: will deepcopy lua values
currently, use upvalues to send lua references in and out.
+ *nvim_buf_create_user_command()*
+nvim_buf_create_user_command({buffer}, {name}, {command}, {*opts})
+ Create a new user command |user-commands| in the given buffer.
+
+ Parameters: ~
+ {buffer} Buffer handle, or 0 for current buffer.
+
+ See also: ~
+ nvim_create_user_command
+
nvim_buf_del_keymap({buffer}, {mode}, {lhs}) *nvim_buf_del_keymap()*
Unmaps a buffer-local |mapping| for the given mode.
@@ -2015,7 +2015,7 @@ nvim_buf_del_user_command({buffer}, {name})
Delete a buffer-local user-defined command.
Only commands created with |:command-buffer| or
- |nvim_buf_add_user_command()| can be deleted with this
+ |nvim_buf_create_user_command()| can be deleted with this
function.
Parameters: ~
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index cc146fcf6e..b31ac47bda 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -243,12 +243,13 @@ If the function acts on an object then {thing} is the name of that object
with a {thing} that groups functions under a common concept).
Use existing common {action} names if possible:
- add Append to, or insert into, a collection
- del Delete a thing (or group of things)
- exec Execute code
- get Get a thing (or group of things by query)
- list Get all things
- set Set a thing (or group of things)
+ add Append to, or insert into, a collection
+ create Create a new thing
+ del Delete a thing (or group of things)
+ exec Execute code
+ get Get a thing (or group of things by query)
+ list Get all things
+ set Set a thing (or group of things)
Use consistent names for {thing} in all API functions. E.g. a buffer is called
"buf" everywhere, not "buffer" in some places and "buf" in others.