]> Sergey Matveev's repositories - nnn.git/commitdiff
Set hovered and file as
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 23 Nov 2019 20:43:27 +0000 (02:13 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 23 Nov 2019 20:43:27 +0000 (02:13 +0530)
README.md
nnn.1
plugins/README.md
src/nnn.c

index 4bd556207b2157a5965e8106090d871e8ff24605..5048951575cedea117f7082c1607057bd98cf3d9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -58,6 +58,7 @@ Add to that an awesome [Wiki](https://github.com/jarun/nnn/wiki)!
   - Copy (as), move (as), delete, archive, link selection
   - Create (with parents), rename, duplicate (anywhere) files and dirs
   - Spawn a shell, run apps, run commands, execute file
+  - Hovered file set as `$nnn` at prompt and spawned shell
   - Lock terminal (needs a locker)
 - Minimal deps, minimal config
 - Widely available
@@ -147,7 +148,7 @@ There is no config file. Associated files are stored under `${XDG_CONFIG_HOME:-$
 | Example `export` | Description |
 | --- | --- |
 | `NNN_BMS='d:~/Documents;D:~/Docs archive/'` | key-bookmark pairs [max 10] |
-| `NNN_PLUG='m:nmount;t:imgthumb;x:_chmod +x $NNN'` | key-plugin (or cmd) pairs (<kbd>:key</kbd> to run) [max 15] |
+| `NNN_PLUG='m:nmount;t:imgthumb;x:_chmod +x $nnn'` | key-plugin (or cmd) pairs (<kbd>:key</kbd> to run) [max 15] |
 | `NNN_USE_EDITOR=1` | open text files in `$VISUAL` (else `$EDITOR`, fallback vi) |
 | `NNN_CONTEXT_COLORS='1234'` | specify per context color [default: '4444' (all blue)] |
 | `NNN_SSHFS_OPTS='sshfs -o reconnect,idmap=user'` | specify SSHFS options |
diff --git a/nnn.1 b/nnn.1
index 0f94c96ff19c7cf787498efdf165bd3476cd5ee3..089fc56556333b9d158e56adf200d164b68d5414 100644 (file)
--- a/nnn.1
+++ b/nnn.1
@@ -192,11 +192,11 @@ when dealing with the !, e and p commands respectively. A single combination to
     To assign keys to arbitrary non-background non-shell-interpreted cli
     commands and invoke like plugins, add \fI_\fR (underscore) before the command.
 .Bd -literal
-    export NNN_PLUG='x:_chmod +x $NNN;g:_git log;s:_smplayer $NNN;o:fzopen'
+    export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn;o:fzopen'
 
     NOTES:
-    1. Use single quotes for $NNN_PLUG so $NNN is not interpreted
-    2. $NNN should be the last argument (IF you want to pass the hovered file name)
+    1. Use single quotes for $NNN_PLUG so $nnn is not interpreted
+    2. $nnn should be the last argument (IF you want to pass the hovered file name)
     3. (Again) add \fI_\fR before the command
 .Ed
 .Pp
index 11b7578f8e13127283b93bf0d98bb63602d331ce..d29f358f3148aea4fe1f44f7cda0b6d838f0d712 100644 (file)
@@ -79,14 +79,14 @@ Now plugin `fzopen` can be run with the keybind <kbd>:o</kbd>, `mocplay` can be
 
 To assign keys to arbitrary non-background cli commands (non-shell-interpreted) and invoke like plugins, add `_` (underscore) before the command. For example:
 
-    export NNN_PLUG='x:_chmod +x $NNN;g:_git log;s:_smplayer $NNN;o:fzopen'
+    export NNN_PLUG='x:_chmod +x $nnn;g:_git log;s:_smplayer $nnn;o:fzopen'
 
 Now <kbd>:x</kbd> can be used to make a file executable, <kbd>:g</kbd> can be used to the git log of a git project directory, <kbd>:s</kbd> can be used to preview a partially downloaded media file.
 
 Notes:
 
-1. Use single quotes for `$NNN_PLUG` so `$NNN` is not interpreted
-2. `$NNN` should be the last argument (IF you want to pass the hovered file name)
+1. Use single quotes for `$NNN_PLUG` so `$nnn` is not interpreted
+2. `$nnn` should be the last argument (IF you want to pass the hovered file name)
 3. (_Again_) add `_` before the command
 
 ## Access level of plugins
index 089bbeb155523e1e95c0b28cc90385acea5bbfa3..0b35ae761fa8ffbbc5495aaf6904fcc7fcb9edc6 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -516,7 +516,7 @@ static const char * const envs[] = {
        "VISUAL",
        "EDITOR",
        "PAGER",
-       "NNN",
+       "nnn",
 };
 
 #ifdef __linux__
@@ -5086,9 +5086,9 @@ nochange:
 
                                        if (tmp[0] == '_' && tmp[1]) {
                                                xstrlcpy(newpath, ++tmp, PATH_MAX);
-                                               if (is_suffix(newpath, " $NNN")) {
+                                               if (is_suffix(newpath, " $nnn")) {
                                                        tmp = (ndents ? dents[cur].name : NULL);
-                                                       /* Set `\0` to clear ' $NNN' suffix */
+                                                       /* Set `\0` to clear ' $nnn' suffix */
                                                        newpath[strlen(newpath) - 5] = '\0';
                                                } else
                                                        tmp = NULL;