diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-01-19 14:38:47 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-01-19 14:51:40 +0530 |
commit | 366f49e6b3ad73f330e04bbaf8020398292c0a3b (patch) | |
tree | ca90ab4f534a198ff04757f91e5ed5dade26f87d /src | |
parent | 772619527f3b235cdb1b3ce13102597300fffc9c (diff) | |
download | nnn-366f49e6b3ad73f330e04bbaf8020398292c0a3b.tar.gz |
Take notes with N
Diffstat (limited to 'src')
-rw-r--r-- | src/nnn.c | 15 | ||||
-rw-r--r-- | src/nnn.h | 3 |
2 files changed, 17 insertions, 1 deletions
@@ -2120,7 +2120,7 @@ static bool show_help(char *path) "1MISC\n" "a!, ^] Spawn SHELL in dir C Execute entry\n" "aR, ^V Run custom script L Lock terminal\n" - "d^S Run a command\n"}; + "d^S Run a command N Take note\n"}; if (fd == -1) return FALSE; @@ -3068,6 +3068,7 @@ nochange: break; // fallthrough case SEL_REDRAW: // fallthrough case SEL_HELP: // fallthrough + case SEL_NOTE: // fallthrough case SEL_LOCK: { if (ndents) @@ -3100,11 +3101,23 @@ nochange: case SEL_RUNEDIT: if (!quote_run_sh_cmd(editor, dents[cur].name, path)) goto nochange; + r = TRUE; break; case SEL_RUNPAGE: r = TRUE; spawn(pager, pager_arg, dents[cur].name, path, F_NORMAL); break; + case SEL_NOTE: + tmp = getenv("NNN_NOTE"); + if (!tmp) { + printmsg("set NNN_NOTE"); + goto nochange; + } + + if (!quote_run_sh_cmd(editor, tmp, NULL)) + goto nochange; + r = TRUE; + break; default: /* SEL_LOCK */ r = TRUE; spawn(utils[LOCKER], NULL, NULL, NULL, F_NORMAL | F_SIGINT); @@ -89,6 +89,7 @@ enum action { SEL_RUNCMD, SEL_RUNEDIT, SEL_RUNPAGE, + SEL_NOTE, SEL_LOCK, SEL_QUITCTX, SEL_QUITCD, @@ -225,6 +226,8 @@ static struct key bindings[] = { /* Open in EDITOR or PAGER */ { 'e', SEL_RUNEDIT }, { 'p', SEL_RUNPAGE }, + /* Open notes file */ + { 'N', SEL_NOTE }, /* Lock screen */ { 'L', SEL_LOCK }, /* Quit a context */ |