@@ -254,7 +254,7 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime. | |||||
MISC | MISC | ||||
! ^] Spawn SHELL C Execute entry | ! ^] Spawn SHELL C Execute entry | ||||
R ^V Run/pick script L Lock terminal | R ^V Run/pick script L Lock terminal | ||||
^P Prompt ^N Note | ^P Prompt ^N Note = Launcher | ||||
``` | ``` | ||||
Help & settings, file details, media info and archive listing are shown in the PAGER. Use the PAGER-specific keys in these screens. | Help & settings, file details, media info and archive listing are shown in the PAGER. Use the PAGER-specific keys in these screens. | ||||
@@ -393,7 +393,6 @@ To lookup keyboard shortcuts at runtime, press <kbd>?</kbd>. | |||||
export NNN_USE_EDITOR=1 | export NNN_USE_EDITOR=1 | ||||
4. Run `n`. | 4. Run `n`. | ||||
5. Don't memorize keys. Arrows, <kbd>/</kbd> and <kbd>q</kbd> suffice. Press <kbd>?</kbd> for help on keyboard shortcuts anytime. | 5. Don't memorize keys. Arrows, <kbd>/</kbd> and <kbd>q</kbd> suffice. Press <kbd>?</kbd> for help on keyboard shortcuts anytime. | ||||
6. The prompt can be used as a launcher and to run commands. | |||||
- For additional functionality [setup custom scripts](https://github.com/jarun/nnn/wiki/How-to#run-custom-scripts). | - For additional functionality [setup custom scripts](https://github.com/jarun/nnn/wiki/How-to#run-custom-scripts). | ||||
- Visit the [How to](https://github.com/jarun/nnn/wiki/How-to) for many more specific usecases. | - Visit the [How to](https://github.com/jarun/nnn/wiki/How-to) for many more specific usecases. | ||||
@@ -408,6 +407,7 @@ The following [user-scripts](https://github.com/jarun/nnn/tree/master/user-scrip | |||||
| edit.sh | Fuzzy find a file in directory subtree with fzy and edit in vim | | | edit.sh | Fuzzy find a file in directory subtree with fzy and edit in vim | | ||||
| fzy.sh | Fuzzy find a file in directory subtree with fzy and open using xdg-open | | | fzy.sh | Fuzzy find a file in directory subtree with fzy and open using xdg-open | | ||||
| imgur.sh | Upload an image file to imgur | | | imgur.sh | Upload an image file to imgur | | ||||
| nlaunch | drop-down app launcher (needs fzy), drop in `$PATH`; fallback regular prompt | | |||||
| picker.sh | Pick files and pipe the newline-separated list to another utility | | | picker.sh | Pick files and pipe the newline-separated list to another utility | | ||||
| sxiv.sh | Open images in current directory in sxiv | | | sxiv.sh | Open images in current directory in sxiv | | ||||
| upgrade.sh | Check and update to latest version of nnn manually on Debian 9 Stretch | | | upgrade.sh | Check and update to latest version of nnn manually on Debian 9 Stretch | | ||||
@@ -159,6 +159,8 @@ Lock terminal | |||||
Show command prompt | Show command prompt | ||||
.It Ic ^N | .It Ic ^N | ||||
Take note | Take note | ||||
.It Ic = | |||||
Launcher | |||||
.El | .El | ||||
.Pp | .Pp | ||||
Backing up one directory level will set the cursor position at the | Backing up one directory level will set the cursor position at the | ||||
@@ -394,7 +394,8 @@ static struct timespec gtimeout; | |||||
#define APACK 4 | #define APACK 4 | ||||
#define VIDIR 5 | #define VIDIR 5 | ||||
#define LOCKER 6 | #define LOCKER 6 | ||||
#define UNKNOWN 7 | #define NLAUNCH 7 | ||||
#define UNKNOWN 8 | |||||
/* Utilities to open files, run actions */ | /* Utilities to open files, run actions */ | ||||
static char * const utils[] = { | static char * const utils[] = { | ||||
@@ -417,6 +418,7 @@ static char * const utils[] = { | |||||
#else | #else | ||||
"vlock", | "vlock", | ||||
#endif | #endif | ||||
"nlaunch", | |||||
"UNKNOWN" | "UNKNOWN" | ||||
}; | }; | ||||
@@ -2385,7 +2387,7 @@ static bool show_help(const char *path) | |||||
"1MISC\n" | "1MISC\n" | ||||
"9! ^] Spawn SHELL C Execute entry\n" | "9! ^] Spawn SHELL C Execute entry\n" | ||||
"9R ^V Run/pick script L Lock terminal\n" | "9R ^V Run/pick script L Lock terminal\n" | ||||
"b^P Prompt ^N Note\n"}; | "b^P Prompt ^N Note = Launcher\n"}; | ||||
if (g_tmpfpath[0]) | if (g_tmpfpath[0]) | ||||
xstrlcpy(g_tmpfpath + g_tmpfplen - 1, messages[STR_TMPFILE], | xstrlcpy(g_tmpfpath + g_tmpfplen - 1, messages[STR_TMPFILE], | ||||
@@ -3741,6 +3743,7 @@ nochange: | |||||
case SEL_EXEC: // fallthrough | case SEL_EXEC: // fallthrough | ||||
case SEL_SHELL: // fallthrough | case SEL_SHELL: // fallthrough | ||||
case SEL_SCRIPT: // fallthrough | case SEL_SCRIPT: // fallthrough | ||||
case SEL_LAUNCH: // fallthrough | |||||
case SEL_RUNCMD: | case SEL_RUNCMD: | ||||
switch (sel) { | switch (sel) { | ||||
case SEL_EXEC: | case SEL_EXEC: | ||||
@@ -3817,6 +3820,11 @@ nochange: | |||||
lastname[0] = '\0'; | lastname[0] = '\0'; | ||||
setdirwatch(); | setdirwatch(); | ||||
goto begin; | goto begin; | ||||
case SEL_LAUNCH: | |||||
if (getutil(utils[NLAUNCH])) { | |||||
spawn(utils[NLAUNCH], NULL, NULL, path, F_NORMAL); | |||||
break; | |||||
} // fallthrough | |||||
default: /* SEL_RUNCMD */ | default: /* SEL_RUNCMD */ | ||||
#ifndef NORL | #ifndef NORL | ||||
if (cfg.picker) { | if (cfg.picker) { | ||||
@@ -88,6 +88,7 @@ enum action { | |||||
SEL_EXEC, | SEL_EXEC, | ||||
SEL_SHELL, | SEL_SHELL, | ||||
SEL_SCRIPT, | SEL_SCRIPT, | ||||
SEL_LAUNCH, | |||||
SEL_RUNCMD, | SEL_RUNCMD, | ||||
SEL_RUNEDIT, | SEL_RUNEDIT, | ||||
SEL_RUNPAGE, | SEL_RUNPAGE, | ||||
@@ -224,6 +225,8 @@ static struct key bindings[] = { | |||||
/* Run a custom script */ | /* Run a custom script */ | ||||
{ 'R', SEL_SCRIPT }, | { 'R', SEL_SCRIPT }, | ||||
{ CONTROL('V'), SEL_SCRIPT }, | { CONTROL('V'), SEL_SCRIPT }, | ||||
/* Launcher */ | |||||
{ '=', SEL_LAUNCH }, | |||||
/* Run a command */ | /* Run a command */ | ||||
{ CONTROL('P'), SEL_RUNCMD }, | { CONTROL('P'), SEL_RUNCMD }, | ||||
/* Open in EDITOR or PAGER */ | /* Open in EDITOR or PAGER */ | ||||
@@ -0,0 +1,17 @@ | |||||
#!/usr/bin/env sh | |||||
# Description: Fuzzy find executables in $PATH and launch an application | |||||
# stdin, stdout, stderr are suppressed so CLI utilities exit silently | |||||
# | |||||
# Shell: POSIX compliant | |||||
# Author: Arun Prakash Jana | |||||
IFS=':' | |||||
get_selection() { | |||||
ls -H $PATH | sort | fzy | |||||
} | |||||
if selection=$( get_selection ); then | |||||
"$selection" 2>&1 >/dev/null & | |||||
fi |