mirror of
https://github.com/jarun/nnn.git
synced 2025-02-17 14:54:36 +00:00
Use run a command to launch apps
This commit is contained in:
parent
b15867143c
commit
cc34b977da
16
README.md
16
README.md
|
@ -71,6 +71,7 @@ We need contributors. Please visit the ToDo list.
|
|||
- [(neo)vim plugin](#neovim-plugin)
|
||||
- [run custom scripts](#run-custom-scripts)
|
||||
- [sample scripts](#sample-scripts)
|
||||
- [launch applications](#launch-applications)
|
||||
- [change dir color](#change-dir-color)
|
||||
- [integrate patool](#integrate-patool)
|
||||
- [lftp transfers](#lftp-transfers)
|
||||
|
@ -116,12 +117,11 @@ We need contributors. Please visit the ToDo list.
|
|||
- Batch rename/move/delete (needs vidir)
|
||||
- Show directories in custom color (default: blue)
|
||||
- Spawn a subshell in the current directory
|
||||
- Run a command
|
||||
- Run a command, launch applications
|
||||
- Run custom scripts in the current directory
|
||||
- Run current file as executable
|
||||
- Change directory at exit (*easy* shell integration)
|
||||
- Edit file in EDITOR or open in PAGER
|
||||
- Application launcher
|
||||
- Terminal locker integration
|
||||
- Unicode support
|
||||
- Highly optimized, static analysis integrated code
|
||||
|
@ -248,9 +248,9 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
|
|||
^J Disk usage S Apparent du
|
||||
t Modification time s Size
|
||||
MISC
|
||||
!, ^] Spawn SHELL in dir o Launch app
|
||||
^S Run a command R Run custom script
|
||||
C Execute entry L Lock terminal
|
||||
!, ^] Spawn SHELL in dir C Execute entry
|
||||
R Run custom script L Lock terminal
|
||||
^S Run a command
|
||||
```
|
||||
|
||||
Help & settings, file details, media info and archive listing are shown in the PAGER. Please use the PAGER-specific keys in these screens.
|
||||
|
@ -353,7 +353,7 @@ Arguments to the `$EDITOR`, `$PAGER` and `$SHELL` should be combined together, e
|
|||
|
||||
export EDITOR='vim -xR'
|
||||
|
||||
The option `open with` takes 1 combined argument and `launcher` takes 2.
|
||||
The option `open with` takes 1 combined argument.
|
||||
|
||||
#### Help
|
||||
|
||||
|
@ -489,6 +489,10 @@ Press <kbd>R</kbd> to run the script in the current directory. You can also use
|
|||
|
||||
xdg-open $(find -type f | fzy) >/dev/null 2>&1
|
||||
|
||||
#### launch applications
|
||||
|
||||
Applications can be launched from the _run a command_ prompt. Use `&` to launch GUI applications in the background.
|
||||
|
||||
#### change dir color
|
||||
|
||||
The default color for directories is blue. Option `-c` accepts color codes from 0 to 7 to use a different color:
|
||||
|
|
12
nnn.1
12
nnn.1
|
@ -18,7 +18,7 @@
|
|||
.Op Ar PATH
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
(Noice is Not Noice) is a performance-optimized, feature-packed fork of noice (http://git.2f30.org/noice/) with seamless desktop integration, simplified navigation, \fInavigate-as-you-type\fR mode, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning and much more. It remains a simple and efficient file manager that stays out of your way.
|
||||
(Noice is Not Noice) is a performance-optimized, feature-packed fork of noice (http://git.2f30.org/noice/) with seamless desktop integration, simplified navigation, \fInavigate-as-you-type\fR mode with auto select, disk usage analyzer mode, bookmarks, contexts, application launcher, familiar navigation shortcuts, subshell spawning and much more. It remains a simple and efficient file manager that stays out of your way.
|
||||
.Pp
|
||||
.Nm
|
||||
opens the current working directory by default if
|
||||
|
@ -145,16 +145,14 @@ MISC
|
|||
.Bl -tag -width "l, [Right], [Return] or C-mXXXX" -offset indent -compact
|
||||
.It Ic \&!, ^]
|
||||
Spawn SHELL in current directory (fallback sh)
|
||||
.It Ic o
|
||||
Launch an application (takes 2 combined arguments)
|
||||
.It Ic ^S
|
||||
Run a command
|
||||
.It Ic R
|
||||
Run or choose a custom script
|
||||
.It Ic C
|
||||
Execute entry
|
||||
.It Ic R
|
||||
Run or choose a custom script
|
||||
.It Ic L
|
||||
Lock terminal
|
||||
.It Ic ^S
|
||||
Run a command
|
||||
.El
|
||||
.Pp
|
||||
Backing up one directory level will set the cursor position at the
|
||||
|
|
45
src/nnn.c
45
src/nnn.c
|
@ -2062,9 +2062,9 @@ static bool show_help(char *path)
|
|||
"d^J Disk usage S Apparent du\n"
|
||||
"et Modification time s Size\n"
|
||||
"1MISC\n"
|
||||
"a!, ^] Spawn SHELL in dir o Launch app\n"
|
||||
"d^S Run a command R Run custom script\n"
|
||||
"eC Execute entry L Lock terminal\n"};
|
||||
"a!, ^] Spawn SHELL in dir C Execute entry\n"
|
||||
"eR Run custom script L Lock terminal\n"
|
||||
"d^S Run a command\n"};
|
||||
|
||||
if (fd == -1)
|
||||
return FALSE;
|
||||
|
@ -3233,15 +3233,9 @@ nochange:
|
|||
case SEL_RENAME:
|
||||
if (!ndents)
|
||||
break; // fallthrough
|
||||
case SEL_LAUNCH: // fallthrough
|
||||
case SEL_NEW:
|
||||
{
|
||||
char *ptr = NULL, *ptr1 = NULL, *ptr2 = NULL;
|
||||
|
||||
switch (sel) {
|
||||
case SEL_LAUNCH:
|
||||
tmp = xreadline(NULL, "launch: ");
|
||||
break;
|
||||
case SEL_ARCHIVE:
|
||||
tmp = xreadline(dents[cur].name, "name: ");
|
||||
break;
|
||||
|
@ -3260,43 +3254,18 @@ nochange:
|
|||
break;
|
||||
|
||||
/* Allow only relative, same dir paths */
|
||||
if ((sel != SEL_LAUNCH) &&
|
||||
(tmp[0] == '/' || strcmp(xbasename(tmp), tmp) != 0)) {
|
||||
if (tmp[0] == '/' || strcmp(xbasename(tmp), tmp) != 0) {
|
||||
printmsg(messages[STR_INPUT_ID]);
|
||||
goto nochange;
|
||||
}
|
||||
|
||||
/* Confirm if app is CLI or GUI */
|
||||
if (sel == SEL_OPEN || sel == SEL_LAUNCH) {
|
||||
if (sel == SEL_OPEN) {
|
||||
r = get_input("press 'c' for cli mode");
|
||||
(r == 'c') ? (r = F_NORMAL) : (r = F_NOWAIT | F_NOTRACE);
|
||||
}
|
||||
|
||||
switch (sel) {
|
||||
case SEL_LAUNCH:
|
||||
{
|
||||
uint args = 0;
|
||||
ptr = tmp;
|
||||
|
||||
while (*ptr) {
|
||||
if (isblank(*ptr)) {
|
||||
*ptr = '\0';
|
||||
if (args == 0)
|
||||
ptr1 = ptr + 1;
|
||||
else if (args == 1)
|
||||
ptr2 = ptr + 1;
|
||||
else
|
||||
break;
|
||||
|
||||
++args;
|
||||
}
|
||||
|
||||
++ptr;
|
||||
}
|
||||
|
||||
spawn(tmp, ptr1, ptr2, path, r);
|
||||
break;
|
||||
}
|
||||
case SEL_ARCHIVE:
|
||||
/* newpath is used as temporary buffer */
|
||||
if (!getutil(utils[APACK])) {
|
||||
|
@ -3307,9 +3276,9 @@ nochange:
|
|||
spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL);
|
||||
break;
|
||||
case SEL_OPEN:
|
||||
getprogarg(tmp, &ptr);
|
||||
getprogarg(tmp, &dir); /* dir used as tmp var */
|
||||
mkpath(path, dents[cur].name, newpath, PATH_MAX);
|
||||
spawn(tmp, ptr, newpath, path, r);
|
||||
spawn(tmp, dir, newpath, path, r);
|
||||
break;
|
||||
case SEL_RENAME:
|
||||
/* Skip renaming to same name */
|
||||
|
|
|
@ -59,7 +59,6 @@ enum action {
|
|||
SEL_STATS,
|
||||
SEL_MEDIA,
|
||||
SEL_FMEDIA,
|
||||
SEL_LAUNCH,
|
||||
SEL_ARCHIVE,
|
||||
SEL_ARCHIVELS,
|
||||
SEL_EXTRACT,
|
||||
|
@ -167,8 +166,6 @@ static struct key bindings[] = {
|
|||
{ 'm', SEL_MEDIA },
|
||||
/* Show media info full, run is hacked */
|
||||
{ 'M', SEL_FMEDIA },
|
||||
/* Launch a GUI application */
|
||||
{ 'o', SEL_LAUNCH },
|
||||
/* Create archive */
|
||||
{ 'f', SEL_ARCHIVE },
|
||||
/* List archive */
|
||||
|
|
Loading…
Reference in a new issue