commands: rename 'fixer' to 'formatter', to be less misleading
The word "fixer" sounds too much as if the command would be able to fix mistakes or correct errors. Especially when seen next to "linter", it sounds as if one does a syntax check and the other fixes the found mistakes. (Although the command might in theory be used for this, it is not its intended purpose.)
Этот коммит содержится в:
родитель
34b1824822
Коммит
4281b6becb
@ -66,7 +66,7 @@
|
||||
<tr><td>Ctrl+J</td><td>Justify paragraph or region</td></tr>
|
||||
<tr><td>Alt+J</td><td>Justify entire buffer</td></tr>
|
||||
<tr><td>Alt+B</td><td>Run a syntax check</td></tr>
|
||||
<tr><td>Alt+F</td><td>Run a "fixer"/formatter/arranger</td></tr>
|
||||
<tr><td>Alt+F</td><td>Run a formatter/fixer/arranger</td></tr>
|
||||
<tr><td>Alt+:</td><td>Start/stop recording of macro</td></tr>
|
||||
<tr><td>Alt+;</td><td>Replay macro</td></tr>
|
||||
</tbody></table>
|
||||
|
@ -1047,7 +1047,7 @@ file, to determine whether this syntax should be used for it.
|
||||
(This functionality only works when @code{libmagic} is installed
|
||||
on the system and will be silently ignored otherwise.)
|
||||
|
||||
@item fixer @var{program} [@var{arg} @dots{}]
|
||||
@item formatter @var{program} [@var{arg} @dots{}]
|
||||
Run the given @var{program} on the full contents of the current buffer.
|
||||
(The current buffer is written out to a temporary file, the program is
|
||||
run on it, and then the temporary file is read back in, replacing the
|
||||
@ -1109,7 +1109,7 @@ to @code{icolor}.
|
||||
@item extendsyntax @var{name} @var{command} [@var{arg} @dots{}]
|
||||
Extend the syntax previously defined as "@var{name}" with another @var{command}.
|
||||
This allows you to add a new @code{color}, @code{icolor}, @code{header},
|
||||
@code{magic}, @code{comment}, @code{linter}, or @code{fixer} command to an already
|
||||
@code{magic}, @code{comment}, @code{linter}, or @code{formatter} command to an already
|
||||
defined syntax --- useful when you want to slightly improve a syntax defined
|
||||
in one of the system-installed files (which normally are not writable).
|
||||
|
||||
@ -1250,7 +1250,7 @@ Counts the number of words, lines and characters in the current buffer.
|
||||
Invokes a spell-checking program, either the default one, or the one
|
||||
defined by @option{--speller} or @code{set speller}.
|
||||
|
||||
@item fixer
|
||||
@item formatter
|
||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||
|
||||
@item linter
|
||||
|
@ -381,7 +381,7 @@ file, to determine whether this syntax should be used for it.
|
||||
(This functionality only works when \fBlibmagic\fP is installed on the
|
||||
system and will be silently ignored otherwise.)
|
||||
.TP
|
||||
.BI fixer " program " \fR[ "arg " \fR...]
|
||||
.BI formatter " program " \fR[ "arg " \fR...]
|
||||
Run the given \fIprogram\fR on the full contents of the current buffer.
|
||||
(The current buffer is written out to a temporary file, the program is
|
||||
run on it, and then the temporary file is read back in, replacing the
|
||||
@ -443,7 +443,7 @@ to \fBicolor\fP.
|
||||
.BI extendsyntax " name command " \fR[ "arg " \fR...]
|
||||
Extend the syntax previously defined as \fIname\fR with another
|
||||
\fIcommand\fR. This allows adding a new \fBcolor\fP, \fBicolor\fP,
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBfixer\fR
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fR
|
||||
command to an already defined syntax -- useful when you want to
|
||||
slightly improve a syntax defined in one of the system-installed
|
||||
files (which normally are not writable).
|
||||
@ -575,7 +575,7 @@ Counts the number of words, lines and characters in the current buffer.
|
||||
Invokes a spell-checking program, either the default one, or the one
|
||||
defined by \fB\-\-speller\fR or \fBset speller\fR.
|
||||
.TP
|
||||
.B fixer
|
||||
.B formatter
|
||||
Invokes a full-buffer-processing program (if the active syntax defines one).
|
||||
.TP
|
||||
.B linter
|
||||
|
14
src/global.c
14
src/global.c
@ -694,8 +694,8 @@ void shortcut_init(void)
|
||||
const char *prevlint_gist = N_("Go to previous linter msg");
|
||||
const char *nextlint_gist = N_("Go to next linter msg");
|
||||
#ifdef ENABLE_SPELLER
|
||||
const char *fixer_gist =
|
||||
N_("Invoke a program to fix/format/arrange the buffer");
|
||||
const char *formatter_gist =
|
||||
N_("Invoke a program to format/arrange/manipulate the buffer");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* ENABLE_HELP */
|
||||
@ -1009,8 +1009,8 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_linter, MMAIN,
|
||||
N_("To Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW);
|
||||
#ifdef ENABLE_SPELLER
|
||||
add_to_funcs(do_fixer, MMAIN,
|
||||
N_("Manipulate"), WITHORSANS(fixer_gist), BLANKAFTER, NOVIEW);
|
||||
add_to_funcs(do_formatter, MMAIN,
|
||||
N_("Formatter"), WITHORSANS(formatter_gist), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -1134,7 +1134,7 @@ void shortcut_init(void)
|
||||
#ifdef ENABLE_COLOR
|
||||
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
|
||||
#ifdef ENABLE_SPELLER
|
||||
add_to_sclist(MMAIN, "M-F", 0, do_fixer, 0);
|
||||
add_to_sclist(MMAIN, "M-F", 0, do_formatter, 0);
|
||||
#endif
|
||||
#endif
|
||||
add_to_sclist(MMAIN, "^C", 0, do_cursorpos_void, 0);
|
||||
@ -1515,8 +1515,8 @@ keystruct *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "linter"))
|
||||
s->func = do_linter;
|
||||
#ifdef ENABLE_SPELLER
|
||||
else if (!strcasecmp(input, "fixer"))
|
||||
s->func = do_fixer;
|
||||
else if (!strcasecmp(input, "formatter"))
|
||||
s->func = do_formatter;
|
||||
#endif
|
||||
#endif
|
||||
else if (!strcasecmp(input, "curpos"))
|
||||
|
@ -231,8 +231,8 @@ typedef struct syntaxtype {
|
||||
/* The list of libmagic results that this syntax applies to. */
|
||||
char *linter;
|
||||
/* The command with which to lint this type of file. */
|
||||
char *fixer;
|
||||
/* The command with which to "fix"/format/modify this type of file. */
|
||||
char *formatter;
|
||||
/* The command with which to format/modify/arrange this type of file. */
|
||||
char *tab;
|
||||
/* What the Tab key should produce; NULL for default behavior. */
|
||||
#ifdef ENABLE_COMMENT
|
||||
|
@ -551,7 +551,7 @@ void do_spell(void);
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
void do_linter(void);
|
||||
void do_fixer(void);
|
||||
void do_formatter(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
|
@ -338,7 +338,7 @@ void begin_new_syntax(char *ptr)
|
||||
live_syntax->headers = NULL;
|
||||
live_syntax->magics = NULL;
|
||||
live_syntax->linter = NULL;
|
||||
live_syntax->fixer = NULL;
|
||||
live_syntax->formatter = NULL;
|
||||
live_syntax->tab = NULL;
|
||||
#ifdef ENABLE_COMMENT
|
||||
live_syntax->comment = copy_of(GENERAL_COMMENT_CHARACTER);
|
||||
@ -960,8 +960,8 @@ bool parse_syntax_commands(char *keyword, char *ptr)
|
||||
#endif
|
||||
} else if (strcasecmp(keyword, "linter") == 0)
|
||||
pick_up_name("linter", ptr, &live_syntax->linter);
|
||||
else if (strcasecmp(keyword, "fixer") == 0)
|
||||
pick_up_name("fixer", ptr, &live_syntax->fixer);
|
||||
else if (strcasecmp(keyword, "formatter") == 0)
|
||||
pick_up_name("formatter", ptr, &live_syntax->formatter);
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
@ -1119,7 +1119,7 @@ void parse_rcfile(FILE *rcstream, bool just_syntax, bool intros_only)
|
||||
strcasecmp(keyword, "comment") == 0 ||
|
||||
strcasecmp(keyword, "tabgives") == 0 ||
|
||||
strcasecmp(keyword, "linter") == 0 ||
|
||||
strcasecmp(keyword, "fixer") == 0)) {
|
||||
strcasecmp(keyword, "formatter") == 0)) {
|
||||
if (!opensyntax)
|
||||
jot_error(N_("A '%s' command requires a preceding "
|
||||
"'syntax' command"), keyword);
|
||||
|
@ -3058,7 +3058,7 @@ void do_linter(void)
|
||||
|
||||
#ifdef ENABLE_SPELLER
|
||||
/* Run a manipulation program on the contents of the buffer. */
|
||||
void do_fixer(void)
|
||||
void do_formatter(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *temp_name;
|
||||
@ -3068,8 +3068,8 @@ void do_fixer(void)
|
||||
if (in_restricted_mode())
|
||||
return;
|
||||
|
||||
if (!openfile->syntax || !openfile->syntax->fixer) {
|
||||
statusbar(_("No fixer is defined for this type of file"));
|
||||
if (!openfile->syntax || !openfile->syntax->formatter) {
|
||||
statusbar(_("No formatter is defined for this type of file"));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3084,7 +3084,7 @@ void do_fixer(void)
|
||||
return;
|
||||
}
|
||||
|
||||
result_msg = treat(temp_name, openfile->syntax->fixer, FALSE);
|
||||
result_msg = treat(temp_name, openfile->syntax->formatter, FALSE);
|
||||
|
||||
if (result_msg != NULL)
|
||||
statusline(ALERT, result_msg);
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Here is an example for Go.
|
||||
|
||||
syntax go "\.go$"
|
||||
fixer gofmt -w
|
||||
formatter gofmt -w
|
||||
comment "//"
|
||||
|
||||
# Types.
|
||||
|
@ -13,9 +13,9 @@ color brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|errorcolor|fu
|
||||
color brightgreen "^[[:space:]]*set[[:space:]]+(fill[[:space:]]+-?[[:digit:]]+|(guidestripe|tabsize)[[:space:]]+[1-9][0-9]*)\>"
|
||||
color brightgreen "^[[:space:]]*bind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+([[:alpha:]]+|".*")[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*unbind[[:space:]]+((\^([[:alpha:]]|[]@\^_]|Space)|M-([[:alpha:]]|[]!"#$%&'()*+,./0-9:;<=>?@\^_`{|}~-]|Space))|F([1-9]|1[0-9]|2[0-4])|Ins|Del)[[:space:]]+(all|main|search|replace(with)?|yesno|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|fixer|linter|tabgives)[[:space:]]+.*"
|
||||
color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(fixer|linter)[[:space:]]+.+)"
|
||||
color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|fixer|linter|tabgives|extendsyntax)\>"
|
||||
color brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|comment|formatter|linter|tabgives)[[:space:]]+.*"
|
||||
color brightgreen "^[[:space:]]*(syntax[[:space:]]+[^[:blank:]]+|(formatter|linter)[[:space:]]+.+)"
|
||||
color green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|comment|formatter|linter|tabgives|extendsyntax)\>"
|
||||
|
||||
# Strings
|
||||
color brightmagenta "([[:space:]]|(start|end)=)".+"([[:space:]]|$)"
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user