aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/README.md
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-10-24 18:54:33 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-10-24 20:25:07 +0530
commitb987931f47a0e062fe85b46052910af2d3c21488 (patch)
treeeeb6097775a77461ba55f11699d69d0e4f540427 /plugins/README.md
parent8c096dad28915c0ba6fdc5eb5a3425381156ded2 (diff)
downloadnnn-b987931f47a0e062fe85b46052910af2d3c21488.tar.gz
Do not pass path to commands
Diffstat (limited to 'plugins/README.md')
-rw-r--r--plugins/README.md22
1 files changed, 12 insertions, 10 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 8cae58b..9007eb4 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -66,12 +66,23 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. You ca
With this, plugin `fzy-open` can be run with the keybind <kbd>:o</kbd>, `mocplay` can be run with <kbd>:p</kbd> and so on... The key vs. plugin pairs are shown in the help and config screen. Up to 10 plugins can have such keybinds.
-To assign keys to arbitrary commands (non-shell-interpreted) and invoke like plugins, add `_` (underscore) before the command. For example:
+To assign keys to arbitrary cli commands (non-shell-interpreted) and invoke like plugins, add `_` (underscore) before the command. For example:
export NNN_PLUG='x:_chmod +x;o:fzy-open'
**Method 2:** Use the _pick plugin_ shortcut to visit the plugin directory and execute a plugin. Repeating the same shortcut cancels the operation and puts you back in the original directory.
+## Access level of plugins
+
+When `nnn` executes a plugin, it does the following:
+- Change to the directory where the plugin is to be run (`$PWD` pointing to the active directory)
+- Passes two arguments to the script:
+ 1. The hovered file's name.
+ 2. The working directory (might differ from `$PWD` in case of symlinked paths; non-canonical). Note that the second argument is not passed in case of commands starting with `_`.
+- Sets the environment variable `NNN_PIPE` used to control `nnn` active directory.
+
+Plugins can also access the current selections by reading the `.selections` file in the config directory (See the `ndiff` plugin for example).
+
## Create your own plugins
Plugins are a powerful yet easy way to extend the capabilities of `nnn`.
@@ -82,15 +93,6 @@ Each script has a _Description_ section which provides more details on what the
The plugins reside in `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
-When `nnn` executes a plugin, it does the following:
-- Change to the directory where the plugin is to be run (`$PWD` pointing to the active directory)
-- Passes two arguments to the script:
- 1. The hovered file's name
- 2. The working directory (might differ from `$PWD` in case of symlinked paths; non-canonical)
-- Sets the environment variable `NNN_PIPE` used to control `nnn` active directory.
-
-Plugins can also access the current selections by reading the `.selections` file in the config directory (See the `ndiff` plugin for example).
-
#### Controlling `nnn`'s active directory
`nnn` provides a mechanism for plugins to control its active directory.
The way to do so is by writing to the pipe pointed by the environment variable `NNN_PIPE`.