]> Sergey Matveev's repositories - nnn.git/commitdiff
Use run a command to launch apps
authorArun Prakash Jana <engineerarun@gmail.com>
Sun, 16 Dec 2018 14:59:03 +0000 (20:29 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sun, 16 Dec 2018 14:59:03 +0000 (20:29 +0530)
README.md
nnn.1
src/nnn.c
src/nnn.h

index 8072c0c4cc7b2ec06dd294a930715e277efd3823..9b8e1c32946c2d08fee8e36f6f81a1bae1696cea 100644 (file)
--- a/README.md
+++ b/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:
diff --git a/nnn.1 b/nnn.1
index 2875bed3e59ce107db71a6a7bd4c1ebfc4bf36dd..e3c45758666bd96ee1704965782c394ab68e60b3 100644 (file)
--- a/nnn.1
+++ b/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
index e29c1688548ebd627885fec00085e33adf78dd8e..b707384918fa3380aaacffe586b4d68b07b50182 100644 (file)
--- a/src/nnn.c
+++ b/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 */
index 74cc815c7ccc9d8d5e7d20fa4d69d8ce0ad5c859..dd9416b5bc884ae21756665b8beaa56011d9d12a 100644 (file)
--- a/src/nnn.h
+++ b/src/nnn.h
@@ -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 */