bindings: make ^T invoke the "Execute Command" menu, and ^T^T the Speller
Make the "Execute Command" menu accessible also with a single keystroke (^T), not just with a double one (^R^X). This is useful, because no one will suspect that "Execute Command" can be found behind "Read File". To not disturb muscle memory too much for people who are used to ^T invoking the Spell Checker, a second ^T will invoke it.master
parent
cd594b85f4
commit
d3954901a9
14
src/files.c
14
src/files.c
|
@ -1072,7 +1072,7 @@ bool execute_command(const char *command)
|
||||||
|
|
||||||
/* Insert a file into the current buffer, or into a new buffer when
|
/* Insert a file into the current buffer, or into a new buffer when
|
||||||
* the MULTIBUFFER flag is set. */
|
* the MULTIBUFFER flag is set. */
|
||||||
void do_insertfile(void)
|
void do_insertfile(bool execute)
|
||||||
{
|
{
|
||||||
int response;
|
int response;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
|
@ -1080,7 +1080,6 @@ void do_insertfile(void)
|
||||||
/* The last answer the user typed at the status-bar prompt. */
|
/* The last answer the user typed at the status-bar prompt. */
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
format_type was_fmt = openfile->fmt;
|
format_type was_fmt = openfile->fmt;
|
||||||
bool execute = FALSE;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Display newlines in filenames as ^J. */
|
/* Display newlines in filenames as ^J. */
|
||||||
|
@ -1269,9 +1268,18 @@ void do_insertfile(void)
|
||||||
void do_insertfile_void(void)
|
void do_insertfile_void(void)
|
||||||
{
|
{
|
||||||
if (!in_restricted_mode())
|
if (!in_restricted_mode())
|
||||||
do_insertfile();
|
do_insertfile(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
/* If the current mode of operation allows it, go prompt for a command. */
|
||||||
|
void do_execute(void)
|
||||||
|
{
|
||||||
|
if (!in_restricted_mode())
|
||||||
|
do_insertfile(TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* For the given bare path (or path plus filename), return the canonical,
|
/* For the given bare path (or path plus filename), return the canonical,
|
||||||
* absolute path (plus filename) when the path exists, and NULL when not. */
|
* absolute path (plus filename) when the path exists, and NULL when not. */
|
||||||
char *get_full_path(const char *origpath)
|
char *get_full_path(const char *origpath)
|
||||||
|
|
23
src/global.c
23
src/global.c
|
@ -693,7 +693,7 @@ void shortcut_init(void)
|
||||||
const char *append_gist = N_("Toggle appending");
|
const char *append_gist = N_("Toggle appending");
|
||||||
const char *prepend_gist = N_("Toggle prepending");
|
const char *prepend_gist = N_("Toggle prepending");
|
||||||
const char *backup_gist = N_("Toggle backing up of the original file");
|
const char *backup_gist = N_("Toggle backing up of the original file");
|
||||||
const char *execute_gist = N_("Execute external command");
|
const char *execute_gist = N_("Execute a function or an external command");
|
||||||
const char *pipe_gist =
|
const char *pipe_gist =
|
||||||
N_("Pipe the current buffer (or marked region) to the command");
|
N_("Pipe the current buffer (or marked region) to the command");
|
||||||
const char *convert_gist = N_("Do not convert from DOS/Mac format");
|
const char *convert_gist = N_("Do not convert from DOS/Mac format");
|
||||||
|
@ -793,13 +793,13 @@ void shortcut_init(void)
|
||||||
N_("Paste"), WITHORSANS(paste_gist), BLANKAFTER, NOVIEW);
|
N_("Paste"), WITHORSANS(paste_gist), BLANKAFTER, NOVIEW);
|
||||||
|
|
||||||
if (!ISSET(RESTRICTED)) {
|
if (!ISSET(RESTRICTED)) {
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
add_to_funcs(do_execute, MMAIN,
|
||||||
|
N_("Execute"), WITHORSANS(execute_gist), TOGETHER, NOVIEW);
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_JUSTIFY
|
#ifdef ENABLE_JUSTIFY
|
||||||
add_to_funcs(do_justify_void, MMAIN,
|
add_to_funcs(do_justify_void, MMAIN,
|
||||||
N_("Justify"), WITHORSANS(justify_gist), TOGETHER, NOVIEW);
|
N_("Justify"), WITHORSANS(justify_gist), BLANKAFTER, NOVIEW);
|
||||||
#endif
|
|
||||||
#ifdef ENABLE_SPELLER
|
|
||||||
add_to_funcs(do_spell, MMAIN,
|
|
||||||
N_("Spelling"), WITHORSANS(spell_gist), BLANKAFTER, NOVIEW);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,8 +1035,12 @@ void shortcut_init(void)
|
||||||
add_to_funcs(zap_text, MMAIN,
|
add_to_funcs(zap_text, MMAIN,
|
||||||
N_("Zap"), WITHORSANS(zap_gist), BLANKAFTER, NOVIEW);
|
N_("Zap"), WITHORSANS(zap_gist), BLANKAFTER, NOVIEW);
|
||||||
|
|
||||||
#ifdef ENABLE_COLOR
|
|
||||||
if (!ISSET(RESTRICTED)) {
|
if (!ISSET(RESTRICTED)) {
|
||||||
|
#ifdef ENABLE_SPELLER
|
||||||
|
add_to_funcs(do_spell, MMAIN,
|
||||||
|
N_("Spell Check"), WITHORSANS(spell_gist), TOGETHER, NOVIEW);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_COLOR
|
||||||
add_to_funcs(do_linter, MMAIN,
|
add_to_funcs(do_linter, MMAIN,
|
||||||
N_("Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW);
|
N_("Linter"), WITHORSANS(lint_gist), TOGETHER, NOVIEW);
|
||||||
add_to_funcs(do_formatter, MMAIN,
|
add_to_funcs(do_formatter, MMAIN,
|
||||||
|
@ -1174,12 +1178,15 @@ void shortcut_init(void)
|
||||||
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
||||||
add_to_sclist(MMOST, "^K", 0, cut_text, 0);
|
add_to_sclist(MMOST, "^K", 0, cut_text, 0);
|
||||||
add_to_sclist(MMOST, "^U", 0, paste_text, 0);
|
add_to_sclist(MMOST, "^U", 0, paste_text, 0);
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
add_to_sclist(MMAIN, "^T", 0, do_execute, 0);
|
||||||
|
#endif
|
||||||
#ifdef ENABLE_JUSTIFY
|
#ifdef ENABLE_JUSTIFY
|
||||||
add_to_sclist(MMAIN, "^J", '\n', do_justify_void, 0);
|
add_to_sclist(MMAIN, "^J", '\n', do_justify_void, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
add_to_sclist(MMAIN, "^T", 0, do_spell, 0);
|
|
||||||
add_to_sclist(MEXECUTE, "^S", 0, do_spell, 0);
|
add_to_sclist(MEXECUTE, "^S", 0, do_spell, 0);
|
||||||
|
add_to_sclist(MEXECUTE, "^T", 0, do_spell, 0);
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_COLOR
|
#ifdef ENABLE_COLOR
|
||||||
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
|
add_to_sclist(MMAIN, "M-B", 0, do_linter, 0);
|
||||||
|
|
|
@ -294,6 +294,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||||
int open_file(const char *filename, bool newfie, FILE **f);
|
int open_file(const char *filename, bool newfie, FILE **f);
|
||||||
char *get_next_filename(const char *name, const char *suffix);
|
char *get_next_filename(const char *name, const char *suffix);
|
||||||
void do_insertfile_void(void);
|
void do_insertfile_void(void);
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
void do_execute(void);
|
||||||
|
#endif
|
||||||
char *get_full_path(const char *origpath);
|
char *get_full_path(const char *origpath);
|
||||||
char *safe_tempfile(FILE **f);
|
char *safe_tempfile(FILE **f);
|
||||||
#ifdef ENABLE_OPERATINGDIR
|
#ifdef ENABLE_OPERATINGDIR
|
||||||
|
|
Loading…
Reference in New Issue