Readline: make M-Enter insert a newline
Before, it was only possible with C-v C-j but it's too useful to require such an awkward method. There is a precedent in, e.g., zsh and fish for the new binding.
This commit is contained in:
parent
84702fa47d
commit
897a263ee7
@ -246,11 +246,23 @@ input_rl_on_run_editor (int count, int key)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
input_rl_newline_insert (int count, int key)
|
||||||
|
{
|
||||||
|
(void) count;
|
||||||
|
(void) key;
|
||||||
|
|
||||||
|
rl_insert_text ("\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
input_rl_on_startup (void)
|
input_rl_on_startup (void)
|
||||||
{
|
{
|
||||||
rl_add_defun ("run-editor", input_rl_on_run_editor, -1);
|
rl_add_defun ("run-editor", input_rl_on_run_editor, -1);
|
||||||
rl_bind_keyseq ("\\ee", rl_named_function ("run-editor"));
|
rl_bind_keyseq ("\\ee", rl_named_function ("run-editor"));
|
||||||
|
rl_add_defun ("newline-insert", input_rl_newline_insert, -1);
|
||||||
|
rl_bind_keyseq ("\\e\\r", rl_named_function ("newline-insert"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user