]> Sergey Matveev's repositories - nnn.git/commitdiff
export NNN_PREFER_SELECTION to all plugins
authorNRK <nrk@disroot.org>
Fri, 17 Feb 2023 13:24:45 +0000 (19:24 +0600)
committerNRK <nrk@disroot.org>
Fri, 17 Feb 2023 13:24:45 +0000 (19:24 +0600)
plugins/README.md
src/nnn.c

index 460f2af9558032f233b2d05857635e9441b91347..4ba2d6e8712b69a10bf76b53c10604097a9d3cb5 100644 (file)
@@ -212,6 +212,7 @@ When `nnn` executes a plugin, it does the following:
     3. `$3`: The picker mode output file (`-` for stdout) if `nnn` is executed as a file picker.
 - Sets the environment variable `NNN_PIPE` used to control `nnn` active directory.
 - Sets the environment variable `NNN_INCLUDE_HIDDEN` to `1` if hidden files are active, `0` otherwise.
+- Sets the environment variable `NNN_PREFER_SELECTION` to `1` if user prefers to use selection (see nnn's `-u` flag), `0` otherwise.
 - Exports the [special variables](https://github.com/jarun/nnn/wiki/Concepts#special-variables).
 
 Plugins can also read the `.selection` file in the config directory.
index f35fb3f93599623a98f2e7f3bc5789f01fd05bf1..635b891178fe31e0b6c06bf4af7381a08f4c1e39 100644 (file)
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -5174,6 +5174,7 @@ static void setexports(void)
                }
        }
        setenv("NNN_INCLUDE_HIDDEN", xitoa(cfg.showhidden), 1);
+       setenv("NNN_PREFER_SELECTION", xitoa(cfg.prefersel), 1);
 }
 
 static void run_cmd_as_plugin(const char *file, uchar_t flags)