diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 324151ee58..c87b6f1835 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4254,7 +4254,7 @@ A jump table for the options with a short description can be found at |Q_op|. Warning: Setting this option can make pending mappings to be aborted when the mouse is moved. - *'mousescroll'* + *'mousescroll'* *E5080* 'mousescroll' string (default "ver:3,hor:6") global This option controls the number of lines / columns to scroll by when diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c index 284c94a712..74348052b0 100644 --- a/src/nvim/arglist.c +++ b/src/nvim/arglist.c @@ -63,6 +63,8 @@ typedef struct { # include "arglist.c.generated.h" #endif +static const char e_window_layout_changed_unexpectedly[] + = N_("E249: Window layout changed unexpectedly"); static const char e_cannot_change_arglist_recursively[] = N_("E1156: Cannot change the argument list recursively"); @@ -976,7 +978,7 @@ static void arg_all_open_windows(arg_all_state_T *aall, int count) aall->new_curwin = wp; aall->new_curtab = curtab; } else if (wp->w_frame->fr_parent != curwin->w_frame->fr_parent) { - emsg(_("E249: window layout changed unexpectedly")); + emsg(_(e_window_layout_changed_unexpectedly)); i = count; break; } else { diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index b5109b4b21..2d5d8e262b 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -56,6 +56,9 @@ # include "autocmd.c.generated.h" #endif +static const char e_autocommand_nesting_too_deep[] + = N_("E218: Autocommand nesting too deep"); + // Naming Conventions: // - general autocmd behavior start with au_ // - AutoCmd start with aucmd_ @@ -1589,7 +1592,7 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force // Allow nesting of autocommands, but restrict the depth, because it's // possible to create an endless loop. if (nesting == 10) { - emsg(_("E218: autocommand nesting too deep")); + emsg(_(e_autocommand_nesting_too_deep)); goto BYPASS_AU; } diff --git a/src/nvim/bufwrite.c b/src/nvim/bufwrite.c index de56c5c717..84c1276b8b 100644 --- a/src/nvim/bufwrite.c +++ b/src/nvim/bufwrite.c @@ -49,7 +49,16 @@ #include "nvim/undo.h" #include "nvim/vim.h" -static char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')"; +static const char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions')"; +static const char e_patchmode_cant_touch_empty_original_file[] + = N_("E206: Patchmode: can't touch empty original file"); +static const char e_write_error_conversion_failed_make_fenc_empty_to_override[] + = N_("E513: Write error, conversion failed (make 'fenc' empty to override)"); +static const char e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override[] + = N_("E513: Write error, conversion failed in line %" PRIdLINENR + " (make 'fenc' empty to override)"); +static const char e_write_error_file_system_full[] + = N_("E514: Write error (file system full?)"); static const char e_no_matching_autocommands_for_buftype_str_buffer[] = N_("E676: No matching autocommands for buftype=%s buffer"); @@ -1064,7 +1073,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en if (buf->b_ml.ml_mfp == NULL) { // This can happen during startup when there is a stray "w" in the // vimrc file. - emsg(_(e_emptybuf)); + emsg(_(e_empty_buffer)); return FAIL; } @@ -1685,20 +1694,18 @@ restore_backup: if (err.msg == NULL) { if (write_info.bw_conv_error) { if (write_info.bw_conv_error_lnum == 0) { - err = set_err(_("E513: write error, conversion failed " - "(make 'fenc' empty to override)")); + err = set_err(_(e_write_error_conversion_failed_make_fenc_empty_to_override)); } else { err = set_err(xmalloc(300)); err.alloc = true; vim_snprintf(err.msg, 300, // NOLINT(runtime/printf) - _("E513: write error, conversion failed in line %" PRIdLINENR - " (make 'fenc' empty to override)"), + _(e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override), write_info.bw_conv_error_lnum); } } else if (got_int) { err = set_err(_(e_interr)); } else { - err = set_err(_("E514: write error (file system full?)")); + err = set_err(_(e_write_error_file_system_full)); } } @@ -1837,7 +1844,7 @@ restore_backup: || (empty_fd = os_open(org, O_CREAT | O_EXCL | O_NOFOLLOW, perm < 0 ? 0666 : (perm & 0777))) < 0) { - emsg(_("E206: patchmode: can't touch empty original file")); + emsg(_(e_patchmode_cant_touch_empty_original_file)); } else { close(empty_fd); } diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c index f21e632036..428f9f28e4 100644 --- a/src/nvim/cursor_shape.c +++ b/src/nvim/cursor_shape.c @@ -26,6 +26,8 @@ # include "cursor_shape.c.generated.h" #endif +static const char e_digit_expected[] = N_("E548: Digit expected"); + /// Handling of cursor and mouse pointer shapes in various modes. cursorentry_T shape_table[SHAPE_IDX_COUNT] = { // Values are set by 'guicursor' and 'mouseshape'. @@ -101,7 +103,7 @@ Array mode_style_array(Arena *arena) /// @param what SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape') /// /// @returns error message for an illegal option, NULL otherwise. -char *parse_shape_opt(int what) +const char *parse_shape_opt(int what) { char *colonp; char *commap; @@ -194,7 +196,7 @@ char *parse_shape_opt(int what) if (len != 0) { p += len; if (!ascii_isdigit(*p)) { - return N_("E548: digit expected"); + return e_digit_expected; } int n = getdigits_int(&p, false, 0); if (len == 3) { // "ver" or "hor" diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d9d4708b89..07f65bbf22 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -95,6 +95,8 @@ static const char e_cannot_index_special_variable[] static const char *e_nowhitespace = N_("E274: No white space allowed before parenthesis"); static const char *e_write2 = N_("E80: Error while writing: %s"); +static const char e_variable_nested_too_deep_for_making_copy[] + = N_("E698: Variable nested too deep for making a copy"); static const char *e_string_list_or_blob_required = N_("E1098: String, List or Blob required"); static const char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s"); static const char e_dot_can_only_be_used_on_dictionary_str[] @@ -1613,7 +1615,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const if (lp->ll_li == NULL) { tv_clear(&var2); if (!quiet) { - semsg(_(e_listidx), (int64_t)lp->ll_n1); + semsg(_(e_list_index_out_of_range_nr), (int64_t)lp->ll_n1); } return NULL; } @@ -1629,7 +1631,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const listitem_T *ni = tv_list_find(lp->ll_list, (int)lp->ll_n2); if (ni == NULL) { if (!quiet) { - semsg(_(e_listidx), (int64_t)lp->ll_n2); + semsg(_(e_list_index_out_of_range_nr), (int64_t)lp->ll_n2); } return NULL; } @@ -1642,7 +1644,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const } if (lp->ll_n2 < lp->ll_n1) { if (!quiet) { - semsg(_(e_listidx), (int64_t)lp->ll_n2); + semsg(_(e_list_index_out_of_range_nr), (int64_t)lp->ll_n2); } return NULL; } @@ -3567,7 +3569,7 @@ static int check_can_index(typval_T *rettv, bool evaluate, bool verbose) return FAIL; case VAR_FLOAT: if (verbose) { - emsg(_(e_float_as_string)); + emsg(_(e_using_float_as_string)); } return FAIL; case VAR_BOOL: @@ -7692,7 +7694,7 @@ int var_item_copy(const vimconv_T *const conv, typval_T *const from, typval_T *c int ret = OK; if (recurse >= DICT_MAXNEST) { - emsg(_("E698: variable nested too deep for making a copy")); + emsg(_(e_variable_nested_too_deep_for_making_copy)); return FAIL; } recurse++; diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c index 9caea2fef1..7668fb129f 100644 --- a/src/nvim/eval/executor.c +++ b/src/nvim/eval/executor.c @@ -20,7 +20,8 @@ # include "eval/executor.c.generated.h" // IWYU pragma: export #endif -char *e_listidx = N_("E684: list index out of range: %" PRId64); +char *e_list_index_out_of_range_nr + = N_("E684: List index out of range: %" PRId64); /// Handle tv1 += tv2, -=, *=, /=, %=, .= /// diff --git a/src/nvim/eval/executor.h b/src/nvim/eval/executor.h index 3d789f76a5..42abf77f4a 100644 --- a/src/nvim/eval/executor.h +++ b/src/nvim/eval/executor.h @@ -3,7 +3,7 @@ #include "nvim/eval/typval.h" -extern char *e_listidx; +extern char *e_list_index_out_of_range_nr; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "eval/executor.h.generated.h" diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index f898063fb0..927c1b3d5c 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -148,6 +148,8 @@ PRAGMA_DIAG_POP static const char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob"); static const char *e_invalwindow = N_("E957: Invalid window number"); +static const char e_invalid_submatch_number_nr[] + = N_("E935: Invalid submatch number: %d"); static const char *e_reduceempty = N_("E998: Reduce of an empty %s with no initial value"); static const char e_missing_function_argument[] = N_("E1132: Missing function argument"); @@ -928,7 +930,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) if (!error) { li = tv_list_find(l, (int)idx); if (li == NULL) { - semsg(_(e_listidx), idx); + semsg(_(e_list_index_out_of_range_nr), idx); } } } @@ -1902,7 +1904,7 @@ static void extend(typval_T *argvars, typval_T *rettv, char *arg_errmsg, bool is } else { item = tv_list_find(l1, (int)before); if (item == NULL) { - semsg(_(e_listidx), (int64_t)before); + semsg(_(e_list_index_out_of_range_nr), (int64_t)before); return; } } @@ -3729,7 +3731,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) if (before != tv_list_len(l)) { item = tv_list_find(l, (int)before); if (item == NULL) { - semsg(_(e_listidx), before); + semsg(_(e_list_index_out_of_range_nr), before); l = NULL; } } @@ -8027,7 +8029,7 @@ static void f_submatch(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) } if (no < 0 || no >= NSUBEXP) { - semsg(_("E935: invalid submatch number: %d"), no); + semsg(_(e_invalid_submatch_number_nr), no); return; } int retList = 0; diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index 79f514bc71..5f0c082ada 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -40,6 +40,10 @@ # include "eval/typval.c.generated.h" #endif +static const char e_variable_nested_too_deep_for_unlock[] + = N_("E743: Variable nested too deep for (un)lock"); +static const char e_using_invalid_value_as_string[] + = N_("E908: Using an invalid value as a String"); static const char e_string_required_for_argument_nr[] = N_("E1174: String required for argument %d"); static const char e_non_empty_string_required_for_argument_nr[] @@ -793,7 +797,7 @@ int tv_list_slice_or_index(list_T *list, bool range, varnumber_T n1_arg, varnumb // A list index out of range is an error. if (!range) { if (verbose) { - semsg(_(e_listidx), (int64_t)n1); + semsg(_(e_list_index_out_of_range_nr), (int64_t)n1); } return FAIL; } @@ -987,7 +991,7 @@ void tv_list_remove(typval_T *argvars, typval_T *rettv, const char *arg_errmsg) if (error) { // Type error: do nothing, errmsg already given. } else if ((item = tv_list_find(l, (int)idx)) == NULL) { - semsg(_(e_listidx), idx); + semsg(_(e_list_index_out_of_range_nr), idx); } else { if (argvars[2].v_type == VAR_UNKNOWN) { // Remove one item, return its value. @@ -1001,7 +1005,7 @@ void tv_list_remove(typval_T *argvars, typval_T *rettv, const char *arg_errmsg) if (error) { // Type error: do nothing. } else if ((item2 = tv_list_find(l, (int)end)) == NULL) { - semsg(_(e_listidx), end); + semsg(_(e_list_index_out_of_range_nr), end); } else { int cnt = 0; @@ -1575,7 +1579,7 @@ const char *tv_list_find_str(list_T *const l, const int n) { const listitem_T *const li = tv_list_find(l, n); if (li == NULL) { - semsg(_(e_listidx), (int64_t)n); + semsg(_(e_list_index_out_of_range_nr), (int64_t)n); return NULL; } return tv_get_string(TV_LIST_ITEM_TV(li)); @@ -3583,7 +3587,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock, const boo static int recurse = 0; if (recurse >= DICT_MAXNEST) { - emsg(_("E743: variable nested too deep for (un)lock")); + emsg(_(e_variable_nested_too_deep_for_unlock)); return; } if (deep == 0) { @@ -3933,16 +3937,16 @@ bool tv_check_num(const typval_T *const tv) return false; } -#define FUNC_ERROR "E729: using Funcref as a String" +#define FUNC_ERROR "E729: Using a Funcref as a String" static const char *const str_errors[] = { [VAR_PARTIAL]= N_(FUNC_ERROR), [VAR_FUNC]= N_(FUNC_ERROR), - [VAR_LIST]= N_("E730: using List as a String"), - [VAR_DICT]= N_("E731: using Dictionary as a String"), - [VAR_FLOAT]= e_float_as_string, - [VAR_BLOB]= N_("E976: using Blob as a String"), - [VAR_UNKNOWN]= e_inval_string, + [VAR_LIST]= N_("E730: Using a List as a String"), + [VAR_DICT]= N_("E731: Using a Dictionary as a String"), + [VAR_FLOAT]= e_using_float_as_string, + [VAR_BLOB]= N_("E976: Using a Blob as a String"), + [VAR_UNKNOWN]= e_using_invalid_value_as_string, }; #undef FUNC_ERROR diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index de6c4bab60..64177d13e8 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -52,6 +52,10 @@ static const char *e_letunexp = N_("E18: Unexpected characters in :let"); static const char *e_lock_unlock = N_("E940: Cannot lock or unlock variable %s"); +static const char e_setting_str_to_value_with_wrong_type[] + = N_("E963: Setting %s to value with wrong type"); +static const char e_cannot_use_heredoc_here[] + = N_("E991: Cannot use =<< here"); /// Evaluate one Vim expression {expr} in string "p" and append the /// resulting string to "gap". "p" points to the opening "{". @@ -169,7 +173,7 @@ list_T *heredoc_get(exarg_T *eap, char *cmd, bool script_get) char dot[] = "."; if (eap->getline == NULL) { - emsg(_("E991: cannot use =<< here")); + emsg(_(e_cannot_use_heredoc_here)); return NULL; } @@ -1457,7 +1461,7 @@ void set_var_const(const char *name, const size_t name_len, typval_T *const tv, } return; } else if (v->di_tv.v_type != tv->v_type) { - semsg(_("E963: setting %s to value with wrong type"), name); + semsg(_(e_setting_str_to_value_with_wrong_type), name); return; } } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 2c31f742c3..dbfd1088d2 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -126,6 +126,9 @@ typedef struct { # include "ex_cmds.c.generated.h" #endif +static const char e_non_numeric_argument_to_z[] + = N_("E144: Non-numeric argument to :z"); + /// ":ascii" and "ga" implementation void do_ascii(const exarg_T *const eap) { @@ -2952,7 +2955,7 @@ void ex_z(exarg_T *eap) if (*x != 0) { if (!ascii_isdigit(*x)) { - emsg(_("E144: non-numeric argument to :z")); + emsg(_(e_non_numeric_argument_to_z)); return; } bigness = atol(x); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index deaa24452b..40259767ff 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -53,6 +53,9 @@ # include "ex_cmds2.c.generated.h" #endif +static const char e_compiler_not_supported_str[] + = N_("E666: Compiler not supported: %s"); + void ex_ruby(exarg_T *eap) { script_host_execute("ruby", eap); @@ -731,7 +734,7 @@ void ex_compiler(exarg_T *eap) // Try lua compiler snprintf(buf, bufsize, "compiler/%s.lua", eap->arg); if (source_runtime(buf, DIP_ALL) == FAIL) { - semsg(_("E666: compiler not supported: %s"), eap->arg); + semsg(_(e_compiler_not_supported_str), eap->arg); } } xfree(buf); diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 0e6d4bba1b..bccd554095 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -87,12 +87,22 @@ static const char e_ambiguous_use_of_user_defined_command[] = N_("E464: Ambiguous use of user-defined command"); +static const char e_no_call_stack_to_substitute_for_stack[] + = N_("E489: No call stack to substitute for \"\""); static const char e_not_an_editor_command[] = N_("E492: Not an editor command"); +static const char e_no_autocommand_file_name_to_substitute_for_afile[] + = N_("E495: No autocommand file name to substitute for \"\""); +static const char e_no_autocommand_buffer_name_to_substitute_for_abuf[] + = N_("E496: No autocommand buffer number to substitute for \"\""); +static const char e_no_autocommand_match_name_to_substitute_for_amatch[] + = N_("E497: No autocommand match name to substitute for \"\""); static const char e_no_source_file_name_to_substitute_for_sfile[] - = N_("E498: no :source file name to substitute for \"\""); -static const char e_no_call_stack_to_substitute_for_stack[] - = N_("E489: no call stack to substitute for \"\""); + = N_("E498: No :source file name to substitute for \"\""); +static const char e_no_line_number_to_use_for_slnum[] + = N_("E842: No line number to use for \"\""); +static const char e_no_line_number_to_use_for_sflnum[] + = N_("E961: No line number to use for \"\""); static const char e_no_script_file_name_to_substitute_for_script[] = N_("E1274: No script file name to substitute for \"