]> Sergey Matveev's repositories - nnn.git/commitdiff
Hover on dir and connect remote
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 10 Apr 2020 13:02:28 +0000 (18:32 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 10 Apr 2020 14:23:16 +0000 (19:53 +0530)
README.md
nnn.1
src/nnn.c

index b335f9180ed73ed1638cf0457a99082604202dc2..8cffd69c1ddd81f67d0cd1cf21150d7352bdc087 100644 (file)
--- a/README.md
+++ b/README.md
 
 It runs smoothly on the Pi, [Termux](https://www.youtube.com/watch?v=AbaauM7gUJw) (Android), Linux, macOS, BSD, Haiku, Cygwin, WSL, across DEs and GUI utilities or a strictly CLI environment.
 
-Once installed (instructions below), visit the [Wiki](https://github.com/jarun/nnn/wiki).
-
-## Black magic!
-
-1. Turbo navigate with automatic dir selection
-2. Select files from anywhere (not just a single dir)
-3. Run custom commands with custom hotkeys
-4. Edit and preview markdown, man page, html quickly
-5. Open a file and auto-proceed to the next
-6. Export (filtered) list of files to a text file
-7. Find files by mime-type and list in `nnn`
-8. Write a plugin in any language you know
-9. Configure the middle mouse click to do anything
-10. Fuzzy search subtree and open the directory of a file
-11. Load four dirs with custom settings at once
-12. Show notifications on cp, mv completion
-13. Auto-sync selection to system clipboard
-14. Open text files detached in another pane/tab/window
-15. Create files/dirs/duplicates with parents (like `mkdir -p`)
-16. Toggle hidden with <kbd>.</kbd>, go HOME with <kbd>~</kbd> or to the last dir with <kbd>-</kbd>
-17. Pin a frequently visited directory at runtime
-18. Mount any cloud storage service in few keypresses
-19. Mount and modify archives
-20. Filter filtered entries
-21. Sort files by access time and inode change time
-22. Access selection from another instance of `nnn`
-23. Compile out features you don't need
-24. Watch matrix text flying or read random fortune messages
-25. Configure it in 5 minutes!
+## Black magic! :dark_sunglasses:
+
+1. Load and filter thousands of files instantly
+2. Turbo navigate with automatic dir selection
+3. Select files from anywhere (not just a single dir)
+4. Run custom commands with custom hotkeys
+5. Edit and preview markdown, man page, html
+6. Open a file and auto-proceed to the next
+7. Export (filtered) list of visible files
+8. Find files by mime-type and list in `nnn`
+9. Write a plugin in any language you know
+10. Configure the middle mouse click to do anything
+11. Fuzzy search subtree and open the dir of a file
+12. Load four dirs with custom settings at once
+13. Show notifications on cp, mv completion
+14. Auto-sync selection to system clipboard
+15. Open text files detached in another pane/tab/window
+16. Create files/dirs/duplicates with parents (like `mkdir -p`)
+17. Toggle hidden with <kbd>.</kbd>, go HOME with <kbd>~</kbd> or to the last dir with <kbd>-</kbd>
+18. Pin a frequently visited dir at runtime
+19. Mount any cloud storage service in a few keypresses
+20. Mount and modify archives
+21. Filter filtered entries
+22. Sort files by access time and inode change time
+23. Access selection from another instance of `nnn`
+24. Compile out features you don't need
+25. Watch matrix text fly or read fortune messages
+26. Configure it in 5 minutes!
+
+Once installed (instructions below), _**read the fine [manual](https://github.com/jarun/nnn/wiki)**_.
 
 ## Features
 
diff --git a/nnn.1 b/nnn.1
index 69efdcf5de478f8a6a6e8db7e11b0ad3133ae52f..2af1a72f433e7a5ae42070e455cec2d4d829c6f8 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -252,7 +252,13 @@ There are 3 groups of keybinds to add files to selection:
 A selection can be edited, copied, moved, removed, archived or linked.
 .Pp
 Absolute paths of the selected files are copied to \fB.selection\fR file in
-the config directory.
+the config directory. The selection file is shared between multiple program
+instances. The most recent instance writing to the file overwrites the entries
+from earlier writes. If you have 2 instances if
+.Nm
+\fIopen\fR in 2 panes of a terminal multiplexer, you can select in one pane and
+use the selection (e.g. to copy or move) in the other pane (if the instance
+doesn't have any local selection already).
 .Pp
 To edit the selection use the _edit selection_ key. Use this key to remove a
 file from selection after you navigate away from its directory. Editing doesn't
index 4d9ed0bde1e1911449980c389a4198b211fb32b7..6e920b188672d3c441967918ba7b78d34caa84ef 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -539,7 +539,7 @@ static const char * const messages[] = {
        "overwrite?",
        "'s'ave / 'l'oad / 'r'estore?",
        "Quit all contexts?",
-       "remote name: ",
+       "remote name ('-' for hovered): ",
        "archive name: ",
        "open with: ",
        "relative path: ",
@@ -3892,7 +3892,7 @@ static bool archive_mount(char *path, char *newpath)
        return TRUE;
 }
 
-static bool remote_mount(char *newpath)
+static bool remote_mount(char *newpath, char *currentpath)
 {
        uchar flag = F_CLI;
        int opt;
@@ -3928,6 +3928,15 @@ static bool remote_mount(char *newpath)
                return FALSE;
        }
 
+       if (tmp[0] == '-' && !tmp[1]) {
+               if (!strcmp(cfgdir, currentpath) && ndents && (dents[cur].flags & DIR_OR_LINK_TO_DIR))
+                       xstrlcpy(tmp, dents[cur].name, NAME_MAX + 1);
+               else {
+                       printmsg(messages[MSG_FAILED]);
+                       return FALSE;
+               }
+       }
+
        /* Create the mount point */
        mkpath(cfgdir, tmp, newpath);
        if (!xmktree(newpath, TRUE)) {
@@ -5568,7 +5577,7 @@ nochange:
                                        break;
                        } // fallthrough
                case SEL_REMOTE:
-                       if (sel == SEL_REMOTE && !remote_mount(newpath)) {
+                       if (sel == SEL_REMOTE && !remote_mount(newpath, path)) {
                                presel = MSGWAIT;
                                goto nochange;
                        }