Take notes with N

This commit is contained in:
Arun Prakash Jana 2019-01-19 14:38:47 +05:30
parent 772619527f
commit 366f49e6b3
No known key found for this signature in database
GPG key ID: A75979F35C080412
4 changed files with 30 additions and 6 deletions

View file

@ -21,7 +21,7 @@ Noice is Not Noice, a noicer fork...
<p align="center"><i>nnn in action! (Thanks Luke Smith for the video!)</i></a></p>
`nnn` is probably the [fastest and most lightweight](#comparison) file manager you have ever used. It integrates seamlessly with your DE and favourite GUI utilities, has a unique [navigate-as-you-type](#navigate-as-you-type-mode) mode with auto-select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning and much more.
`nnn` is probably the [fastest and most lightweight](#comparison) file manager you have ever used. It integrates seamlessly with your DE and favourite GUI utilities, has a unique [navigate-as-you-type](#navigate-as-you-type-mode) mode with auto-select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning, quick notes and much more.
Integrate utilities like sxiv (image preview) or fzy (fuzzy subtree search) easily, transfer selected files using lftp or use it as a (neo)vim plugin; `nnn` supports as many scripts as you need! Refer to the [How to](https://github.com/jarun/nnn/wiki/How-to) section on wiki for more details.
@ -104,6 +104,7 @@ It runs on Linux, macOS, Raspberry Pi, BSD, Cygwin, Linux subsystem for Windows
- Run current file as executable
- Change directory at exit (*easy* shell integration)
- Edit file in EDITOR or open in PAGER
- Take quick notes
- Terminal locker integration
- Unicode support
- Highly optimized, static analysis integrated code
@ -237,7 +238,7 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
MISC
!, ^] Spawn SHELL in dir C Execute entry
R, ^V Run custom script L Lock terminal
^S Run a command
^S Run a command N Take note
```
Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens.
@ -275,7 +276,7 @@ When a context is quit, the next active context is selected. If the last active
Each context can have its own color for directories specified:
export NNN_CONTEXT_COLORS="1234"
export NNN_CONTEXT_COLORS='1234'
colors: 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
#### Selection

11
nnn.1
View file

@ -148,6 +148,8 @@ Execute entry
Run or choose a custom script
.It Ic L
Lock terminal
.It Ic N
Take note
.It Ic ^S
Run a command
.El
@ -278,7 +280,7 @@ files.
.Pp
\fBNNN_CONTEXT_COLORS:\fR string of color codes for each context, e.g.:
.Bd -literal
export NNN_CONTEXT_COLORS="1234"
export NNN_CONTEXT_COLORS='1234'
codes: 0-black, 1-red, 2-green, 3-yellow, 4-blue (default), 5-magenta, 6-cyan, 7-white
.Ed
@ -292,13 +294,18 @@ files.
The path is shown in the help and configuration screen.
.Ed
.Pp
\fBNNN_SCRIPT:\fR absolute path to a directory to select a script from or a single script to invoke with currently selected file name as argument 1.
\fBNNN_SCRIPT:\fR \fIabsolute\fR path to a directory to select a script from or a single script to invoke with currently selected file name as argument 1.
.Bd -literal
export NNN_SCRIPT=/home/user/scripts
OR
export NNN_SCRIPT=/usr/local/bin/nscript.sh
.Ed
.Pp
\fBNNN_NOTE:\fR \fIabsolute\fR path to a note file.
.Bd -literal
export NNN_NOTE='/home/user/.mynotes'
.Ed
.Pp
\fBNNN_SHOW_HIDDEN:\fR show hidden files.
.Bd -literal
export NNN_SHOW_HIDDEN=1

View file

@ -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);

View file

@ -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 */