docs: fix typos (#19588)

Co-authored-by: zeertzjq <zeertzjq@outlook.com>
Co-authored-by: notomo <notomo.motono@gmail.com>
This commit is contained in:
dundargoc 2022-08-03 03:47:16 +02:00 committed by GitHub
parent cc1ceebf8f
commit b8dcbcc732
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 72 additions and 71 deletions

View File

@ -348,7 +348,7 @@ callbacks. These callbacks are called frequently in various contexts;
|nvim_buf_attach()| will take keyword args for the callbacks. "on_lines" will
receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline},
{new_lastline}, {old_byte_size}[, {old_utf32_size}, {old_utf16_size}]).
{new_lastline}, {old_byte_size} [, {old_utf32_size}, {old_utf16_size}]).
Unlike remote channel events the text contents are not passed. The new text can
be accessed inside the callback as

View File

@ -5311,7 +5311,7 @@ mode([expr]) Return a string that indicates the current mode.
niV Normal using |i_CTRL-O| in |Virtual-Replace-mode|
nt Normal in |terminal-emulator| (insert goes to
Terminal mode)
ntT Normal using |t_CTRL-\_CTRL-O| in |terminal-mode|
ntT Normal using |t_CTRL-\_CTRL-O| in |Terminal-mode|
v Visual by character
vs Visual by character using |v_CTRL-O| in Select mode
V Visual by line

View File

@ -704,7 +704,7 @@ regex:match_str({str}) *regex:match_str()*
As any integer is truth-y, `regex:match()` can be directly used
as a condition in an if-statement.
regex:match_line({bufnr}, {line_idx}[, {start}, {end}]) *regex:match_line()*
regex:match_line({bufnr}, {line_idx} [, {start}, {end}]) *regex:match_line()*
Match line {line_idx} (zero-based) in buffer {bufnr}. If {start} and
{end} are supplied, match only this byte index range. Otherwise see
|regex:match_str()|. If {start} is used, then the returned byte
@ -855,13 +855,13 @@ vim.empty_dict() *vim.empty_dict()*
Note: If numeric keys are present in the table, Nvim ignores the
metatable marker and converts the dict to a list/array anyway.
vim.rpcnotify({channel}, {method}[, {args}...]) *vim.rpcnotify()*
vim.rpcnotify({channel}, {method} [, {args}...]) *vim.rpcnotify()*
Sends {event} to {channel} via |RPC| and returns immediately. If
{channel} is 0, the event is broadcast to all channels.
This function also works in a fast callback |lua-loop-callbacks|.
vim.rpcrequest({channel}, {method}[, {args}...]) *vim.rpcrequest()*
vim.rpcrequest({channel}, {method} [, {args}...]) *vim.rpcrequest()*
Sends a request to {channel} to invoke {method} via |RPC| and blocks
until a response is received.
@ -873,7 +873,7 @@ vim.stricmp({a}, {b}) *vim.stricmp()*
are equal, {a} is greater than {b} or {a} is lesser than {b},
respectively.
vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
vim.str_utfindex({str} [, {index}]) *vim.str_utfindex()*
Convert byte index to UTF-32 and UTF-16 indices. If {index} is not
supplied, the length of the string is used. All indices are zero-based.
Returns two values: the UTF-32 and UTF-16 indices respectively.
@ -883,7 +883,7 @@ vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()*
point each. An {index} in the middle of a UTF-8 sequence is rounded
upwards to the end of that sequence.
vim.str_byteindex({str}, {index}[, {use_utf16}]) *vim.str_byteindex()*
vim.str_byteindex({str}, {index} [, {use_utf16}]) *vim.str_byteindex()*
Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not
supplied, it defaults to false (use UTF-32). Returns the byte index.
@ -1315,7 +1315,7 @@ cmd({command}) *vim.cmd()*
vim.cmd('write! myfile.txt')
vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true }
vim.cmd.write { args = { "myfile.txt" }, bang = true }
vim.cmd.write {"myfile.txt", bang = true })
vim.cmd.write { "myfile.txt", bang = true }
-- Ex command :colorscheme blue
vim.cmd('colorscheme blue')
@ -2229,7 +2229,8 @@ set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()*
• remap: (boolean) Make the mapping recursive.
This is the inverse of the "noremap" option from
|nvim_set_keymap()|. Default `false`.
• replace_keycodes: (boolean) defaults to true.
• replace_keycodes: (boolean) defaults to true if
"expr" is true.
See also: ~
|nvim_set_keymap()|

View File

@ -4210,7 +4210,7 @@ A jump table for the options with a short description can be found at |Q_op|.
The 'mousemodel' option is set by the |:behave| command.
*'mousescroll'*
*'mousescroll'*
'mousescroll' string (default "ver:3,hor:6")
global
This option controls the number of lines / columns to scroll by when

View File

@ -312,7 +312,7 @@ end
--- vim.cmd('write! myfile.txt')
--- vim.cmd { cmd = 'write', args = { "myfile.txt" }, bang = true }
--- vim.cmd.write { args = { "myfile.txt" }, bang = true }
--- vim.cmd.write {"myfile.txt", bang = true })
--- vim.cmd.write { "myfile.txt", bang = true }
---
--- -- Ex command :colorscheme blue
--- vim.cmd('colorscheme blue')

View File

@ -43,7 +43,7 @@ local keymap = {}
--- - remap: (boolean) Make the mapping recursive. This is the
--- inverse of the "noremap" option from |nvim_set_keymap()|.
--- Default `false`.
--- - replace_keycodes: (boolean) defaults to true.
--- - replace_keycodes: (boolean) defaults to true if "expr" is true.
---@see |nvim_set_keymap()|
function keymap.set(mode, lhs, rhs, opts)
vim.validate({

View File

@ -27,7 +27,7 @@ typedef struct {
uint64_t channel_id;
#define UI_BUF_SIZE 4096 ///< total buffer size for pending msgpack data.
/// guranteed size available for each new event (so packing of simple events
/// guaranteed size available for each new event (so packing of simple events
/// and the header of grid_line will never fail)
#define EVENT_BUF_SIZE 256
char buf[UI_BUF_SIZE]; ///< buffer of packed but not yet sent msgpack data
@ -43,7 +43,7 @@ typedef struct {
// We start packing the two outermost msgpack arrays before knowing the total
// number of elements. Thus track the location where array size will need
// to be written in the msgpack buffer, once the specifc array is finished.
// to be written in the msgpack buffer, once the specific array is finished.
char *nevents_pos;
char *ncalls_pos;
uint32_t nevents; ///< number of distinct events (top-level args to "redraw"

View File

@ -43,7 +43,7 @@ cursorentry_T shape_table[SHAPE_IDX_COUNT] =
};
/// Converts cursor_shapes into an Array of Dictionaries
/// @param arena initialized arena where memory will be alocated
/// @param arena initialized arena where memory will be allocated
///
/// @return Array of the form {[ "cursor_shape": ... ], ...}
Array mode_style_array(Arena *arena)

View File

@ -5054,7 +5054,7 @@ int find_help_tags(const char *arg, int *num_matches, char ***matches, bool keep
int i;
// Specific tags that either have a specific replacement or won't go
// throught the generic rules.
// through the generic rules.
static char *(except_tbl[][2]) = {
{ "*", "star" },
{ "g*", "gstar" },

View File

@ -1737,7 +1737,7 @@ static bool at_ins_compl_key(void)
|| ((compl_cont_status & CONT_LOCAL) && (c == Ctrl_N || c == Ctrl_P));
}
/// Check if typebuf.tb_buf[] contains a modifer plus key that can be changed
/// Check if typebuf.tb_buf[] contains a modifier plus key that can be changed
/// into just a key, apply that.
/// Check from typebuf.tb_buf[typebuf.tb_off] to typebuf.tb_buf[typebuf.tb_off + "max_offset"].
/// @return the length of the replaced bytes, 0 if nothing changed, -1 for error.

View File

@ -2002,7 +2002,7 @@ int get_c_indent(void)
}
// #defines and so on go at the left when included in 'cinkeys',
// exluding pragmas when customized in 'cinoptions'
// excluding pragmas when customized in 'cinoptions'
if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', true))) {
const char_u *const directive = (char_u *)skipwhite((char *)theline + 1);
if (curbuf->b_ind_pragma == 0 || STRNCMP(directive, "pragma", 6) != 0) {

View File

@ -7,10 +7,8 @@
//
// Any special key code sequences are replaced by these codes.
//
// For MS-DOS some keys produce codes larger than 0xff. They are split into two
// chars, the first one is K_NUL.
//
/// For MS-DOS some keys produce codes larger than 0xff. They are split into two
/// chars, the first one is K_NUL.
#define K_NUL (0xce) // for MS-DOS: special key follows
/// K_SPECIAL is the first byte of a special key code and is always followed by
@ -59,13 +57,13 @@
#define KS_SELECT 245
#define K_SELECT_STRING (char_u *)"\200\365X"
// Used a termcap entry that produces a normal character.
/// Used a termcap entry that produces a normal character.
#define KS_KEY 242
// Used for click in a tab pages label.
/// Used for click in a tab pages label.
#define KS_TABLINE 240
// Used for menu in a tab pages line.
/// Used for menu in a tab pages line.
#define KS_TABMENU 239
/// Filler used after KS_SPECIAL and others
@ -89,18 +87,19 @@
#define TO_SPECIAL(a, b) ((a) == KS_SPECIAL ? K_SPECIAL : (a) == \
KS_ZERO ? K_ZERO : TERMCAP2KEY(a, b))
// Codes for keys that do not have a termcap name.
// The numbers are fixed to make sure that recorded key sequences remain valid.
// Add new entries at the end, not halfway.
//
// K_SPECIAL KS_EXTRA KE_xxx
//
// Entries must be in the range 0x02-0x7f (see comment at K_SPECIAL).
/// Codes for keys that do not have a termcap name.
/// The numbers are fixed to make sure that recorded key sequences remain valid.
/// Add new entries at the end, not halfway.
///
/// K_SPECIAL KS_EXTRA KE_xxx
///
/// Entries must be in the range 0x02-0x7f (see comment at K_SPECIAL).
enum key_extra {
KE_S_UP = 4, // shift-up
KE_S_DOWN = 5, // shift-down
KE_S_DOWN = 5, // shift-down
KE_S_F1 = 6, // shifted function keys
// shifted function keys
KE_S_F1 = 6,
KE_S_F2 = 7,
KE_S_F3 = 8,
KE_S_F4 = 9,
@ -141,7 +140,7 @@ enum key_extra {
KE_S_F36 = 41,
KE_S_F37 = 42,
KE_MOUSE = 43, // mouse event start
KE_MOUSE = 43, // mouse event start
// Symbols for pseudo keys which are translated from the real key symbols
// above.
@ -153,14 +152,14 @@ enum key_extra {
KE_MIDDLERELEASE = 49, // Middle mouse button release
KE_RIGHTMOUSE = 50, // Right mouse button click
KE_RIGHTDRAG = 51, // Drag with right mouse button down
KE_RIGHTRELEASE = 52, // Right mouse button release
KE_RIGHTRELEASE = 52, // Right mouse button release
KE_IGNORE = 53, // Ignored mouse drag/release
KE_IGNORE = 53, // Ignored mouse drag/release
KE_TAB = 54, // unshifted TAB key
KE_S_TAB_OLD = 55, // shifted TAB key (no longer used)
KE_S_TAB_OLD = 55, // shifted TAB key (no longer used)
// , KE_SNIFF_UNUSED = 56 // obsolete
// KE_SNIFF_UNUSED = 56, // obsolete
KE_XF1 = 57, // extra vt100 function keys for xterm
KE_XF2 = 58,
KE_XF3 = 59,
@ -175,7 +174,7 @@ enum key_extra {
KE_XRIGHT = 68,
KE_LEFTMOUSE_NM = 69, // non-mappable Left mouse button click
KE_LEFTRELEASE_NM = 70, // non-mappable left mouse button release
KE_LEFTRELEASE_NM = 70, // non-mappable left mouse button release
KE_S_XF1 = 71, // vt100 shifted function keys for xterm
KE_S_XF2 = 72,
@ -188,20 +187,20 @@ enum key_extra {
KE_MOUSEDOWN = 75, // scroll wheel pseudo-button Down
KE_MOUSEUP = 76, // scroll wheel pseudo-button Up
KE_MOUSELEFT = 77, // scroll wheel pseudo-button Left
KE_MOUSERIGHT = 78, // scroll wheel pseudo-button Right
KE_MOUSERIGHT = 78, // scroll wheel pseudo-button Right
KE_KINS = 79, // keypad Insert key
KE_KDEL = 80, // keypad Delete key
KE_KDEL = 80, // keypad Delete key
// KE_CSI = 81, // Nvim doesn't need escaping CSI
KE_SNR = 82, // <SNR>
KE_PLUG = 83, // <Plug>
KE_CMDWIN = 84, // open command-line window from Command-line Mode
KE_CMDWIN = 84, // open command-line window from Command-line Mode
KE_C_LEFT = 85, // control-left
KE_C_RIGHT = 86, // control-right
KE_C_HOME = 87, // control-home
KE_C_END = 88, // control-end
KE_C_END = 88, // control-end
KE_X1MOUSE = 89, // X1/X2 mouse-buttons
KE_X1DRAG = 90,
@ -210,16 +209,16 @@ enum key_extra {
KE_X2DRAG = 93,
KE_X2RELEASE = 94,
KE_DROP = 95, // DnD data is available
// , KE_CURSORHOLD = 96 // CursorHold event
KE_NOP = 97, // no-op: does nothing
// , KE_FOCUSGAINED = 98 // focus gained
// , KE_FOCUSLOST = 99 // focus lost
KE_MOUSEMOVE = 100, // mouse moved with no button down
// , KE_CANCEL = 101 // return from vgetc
KE_DROP = 95, // DnD data is available
// KE_CURSORHOLD = 96, // CursorHold event
KE_NOP = 97, // no-op: does nothing
// KE_FOCUSGAINED = 98, // focus gained
// KE_FOCUSLOST = 99, // focus lost
KE_MOUSEMOVE = 100, // mouse moved with no button down
// KE_CANCEL = 101, // return from vgetc()
KE_EVENT = 102, // event
KE_LUA = 103, // lua special key
KE_COMMAND = 104, // <Cmd> special key
KE_LUA = 103, // Lua special key
KE_COMMAND = 104, // <Cmd> special key
};
// the three byte codes are replaced with the following int when using vgetc()
@ -259,7 +258,8 @@ enum key_extra {
#define K_XLEFT TERMCAP2KEY(KS_EXTRA, KE_XLEFT)
#define K_XRIGHT TERMCAP2KEY(KS_EXTRA, KE_XRIGHT)
#define K_F1 TERMCAP2KEY('k', '1') // function keys
// function keys
#define K_F1 TERMCAP2KEY('k', '1')
#define K_F2 TERMCAP2KEY('k', '2')
#define K_F3 TERMCAP2KEY('k', '3')
#define K_F4 TERMCAP2KEY('k', '4')
@ -463,13 +463,13 @@ enum key_extra {
/// Current longest is <M-C-S-T-D-A-4-ScrollWheelRight> (length includes '<' and '>').
#define MAX_KEY_NAME_LEN 32
// Maximum length of a special key event as tokens. This includes modifiers.
// The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
// following string of tokens:
//
// <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KE_LEFTDRAG>.
//
// This is a total of 6 tokens, and is currently the longest one possible.
/// Maximum length of a special key event as tokens. This includes modifiers.
/// The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
/// following string of tokens:
///
/// <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KE_LEFTDRAG>.
///
/// This is a total of 6 tokens, and is currently the longest one possible.
#define MAX_KEY_CODE_LEN 6
#define FLAG_CPO_BSLASH 0x01
@ -477,7 +477,7 @@ enum key_extra {
? 0 \
: FLAG_CPO_BSLASH)
// Flags for replace_termcodes()
/// Flags for replace_termcodes()
enum {
REPTERM_FROM_PART = 1,
REPTERM_DO_LT = 2,
@ -485,7 +485,7 @@ enum {
REPTERM_NO_SIMPLIFY = 8,
};
// Flags for find_special_key()
/// Flags for find_special_key()
enum {
FSK_KEYCODE = 0x01, ///< prefer key code, e.g. K_DEL in place of DEL
FSK_KEEP_X_KEY = 0x02, ///< dont translate xHome to Home key

View File

@ -235,7 +235,7 @@ static void showmap(mapblock_T *mp, bool local)
/// @param[in] orig_lhs Original mapping LHS, with characters to replace.
/// @param[in] orig_lhs_len `strlen` of orig_lhs.
/// @param[in] orig_rhs Original mapping RHS, with characters to replace.
/// @param[in] rhs_lua Lua reference for Lua maps.
/// @param[in] rhs_lua Lua reference for Lua mappings.
/// @param[in] orig_rhs_len `strlen` of orig_rhs.
/// @param[in] cpo_flags See param docs for @ref replace_termcodes.
/// @param[out] mapargs MapArguments struct holding the replaced strings.
@ -1633,7 +1633,7 @@ int makemap(FILE *fd, buf_T *buf)
continue;
}
// skip lua mappings and mappings that contain a <SNR> (script-local thing),
// skip Lua mappings and mappings that contain a <SNR> (script-local thing),
// they probably don't work when loaded again
if (mp->m_luaref != LUA_NOREF) {
continue;
@ -2601,7 +2601,7 @@ fail_and_free:
///
/// @param mode The abbreviation for the mode
/// @param buf The buffer to get the mapping array. NULL for global
/// @param from_lua Whether it is called from internal lua api.
/// @param from_lua Whether it is called from internal Lua api.
/// @returns Array of maparg()-like dictionaries describing mappings
ArrayOf(Dictionary) keymap_array(String mode, buf_T *buf, bool from_lua)
{

View File

@ -546,7 +546,7 @@ void arena_start(Arena *arena, ArenaMem *reuse_blk)
/// Finnish the allocations in an arena.
///
/// This does not immedately free the memory, but leaves existing allocated
/// This does not immediately free the memory, but leaves existing allocated
/// objects valid, and returns an opaque ArenaMem handle, which can be used to
/// free the allocations using `arena_mem_free`, when the objects allocated
/// from the arena are not needed anymore.

View File

@ -4889,7 +4889,7 @@ void op_addsub(oparg_T *oap, linenr_T Prenum1, bool g_cmd)
linenr_T amount = Prenum1;
// do_addsub() might trigger re-evaluation of 'foldexpr' halfway, when the
// buffer is not completly updated yet. Postpone updating folds until before
// buffer is not completely updated yet. Postpone updating folds until before
// the call to changed_lines().
disable_fold_update++;

View File

@ -156,7 +156,7 @@ void rbuffer_consumed(RBuffer *buf, size_t count)
/// Use instead of rbuffer_consumed to use rbuffer in a linear, non-cyclic fashion.
///
/// This is generally usefull if we can guarantee to parse all input
/// This is generally useful if we can guarantee to parse all input
/// except some small incomplete token, like when parsing msgpack.
void rbuffer_consumed_compact(RBuffer *buf, size_t count)
FUNC_ATTR_NONNULL_ALL

View File

@ -1649,7 +1649,7 @@ static void clear_submatch_list(staticList10_T *sl)
/// vim_regexec_multi() match.
///
/// If "flags" has REGSUB_COPY really copy into "dest[destlen]".
/// Oterwise nothing is copied, only compue the length of the result.
/// Otherwise nothing is copied, only compute the length of the result.
///
/// If "flags" has REGSUB_MAGIC then behave like 'magic' is set.
///

View File

@ -53,7 +53,7 @@ UIClientHandler ui_client_get_redraw_handler(const char *name, size_t name_len,
/// Placeholder for _sync_ requests with 'redraw' method name
///
/// async 'redraw' events, which are expected when nvim acts as an ui client.
/// get handled in msgpack_rpc/unpacker.c and directy dispatched to handlers
/// get handled in msgpack_rpc/unpacker.c and directly dispatched to handlers
/// of specific ui events, like ui_client_event_grid_resize and so on.
Object handle_ui_client_redraw(uint64_t channel_id, Array args, Error *error)
{