diff --git a/src/help.c b/src/help.c index 3849aec4..533838b4 100644 --- a/src/help.c +++ b/src/help.c @@ -108,6 +108,9 @@ void do_help(void) int saved_margin = margin; /* For avoiding the line numbers on the help screen. */ ssize_t was_tabsize = tabsize; +#ifndef DISABLE_COLOR + char *was_syntax = syntaxstr; +#endif char *saved_answer = (answer != NULL) ? strdup(answer) : NULL; /* Store current answer when user invokes help at the prompt. */ unsigned stash[sizeof(flags) / sizeof(flags[0])]; @@ -173,6 +176,9 @@ void do_help(void) ++ptr; start_of_text = ptr; +#ifndef DISABLE_COLOR + syntaxstr = "nanohelp"; +#endif display_the_help_text(FALSE); curs_set(0); edit_refresh(); @@ -270,6 +276,9 @@ void do_help(void) free(answer); answer = saved_answer; tabsize = was_tabsize; +#ifndef DISABLE_COLOR + syntaxstr = was_syntax; +#endif remove(tempfilename); free(tempfilename); diff --git a/syntax/Makefile.am b/syntax/Makefile.am index 5e662e2f..4140dee0 100644 --- a/syntax/Makefile.am +++ b/syntax/Makefile.am @@ -22,6 +22,7 @@ pkgdata_DATA = asm.nanorc \ man.nanorc \ mgp.nanorc \ mutt.nanorc \ + nanohelp.nanorc \ nanorc.nanorc \ nftables.nanorc \ objc.nanorc \ diff --git a/syntax/nanohelp.nanorc b/syntax/nanohelp.nanorc new file mode 100644 index 00000000..d6e27e24 --- /dev/null +++ b/syntax/nanohelp.nanorc @@ -0,0 +1,12 @@ +## This is meant for highlighting key combos in a nano help text. + +# It should not apply to any normal file, so no fileregex. +syntax "nanohelp" + +# Key combos: +color brightblue "\^([]A-Z^\_←→↑↓]|Home|End)" "[←→↑↓]" +color brightblue "\<(Tab|Enter|Home|End|Ins|Del|Bsp|PgUp|PgDn)\>" +color brightblue "\