I patched in the ability to specify a custom editor (eg: 'nvim') and summon it with C-G

This commit is contained in:
art 2022-10-06 17:28:03 -04:00
parent 38b7282050
commit 8f0b2dccfd
2 changed files with 8 additions and 0 deletions

View File

@ -7261,6 +7261,7 @@ nochange:
case SEL_HELP: // fallthrough
case SEL_AUTONEXT: // fallthrough
case SEL_EDIT: // fallthrough
case SEL_CEDIT: // fallthrough
case SEL_LOCK:
{
bool refresh = FALSE;
@ -7304,6 +7305,10 @@ nochange:
if (!(g_state.picker || g_state.fifomode))
spawn(editor, newpath, NULL, NULL, F_CLI);
continue;
case SEL_CEDIT:
static char *ceditor;
spawn("nvim", newpath, NULL, NULL, F_CLI);
continue;
default: /* SEL_LOCK */
lock_terminal();
break;

View File

@ -116,6 +116,7 @@ enum action {
SEL_QUITCD,
SEL_QUIT,
SEL_QUITERR,
SEL_CEDIT,
#ifndef NOMOUSE
SEL_CLICK,
#endif
@ -154,6 +155,8 @@ static struct key bindings[] = {
/* First entry */
{ KEY_HOME, SEL_HOME },
{ 'g', SEL_HOME },
/* Open in specified editor */
{ CONTROL('G'), SEL_CEDIT },
{ CONTROL('A'), SEL_HOME },
/* Last entry */
{ KEY_END, SEL_END },