1
0
Fork 0
mirror of https://github.com/jarun/nnn.git synced 2025-03-11 17:24:06 +00:00
nnn/plugins/README.md

58 lines
4.1 KiB
Markdown
Raw Normal View History

2019-06-26 11:45:33 +05:30
To extend the capabilities of `nnn`, plugins are introduced. Plugins are scripts which `nnn` can communicate with and trigger. This mechanism fits perfectly with the fundamental design to keep the core file manager lean and fast, by delegating repetitive (but not necessarily file manager-specific) tasks to the plugins.
The currently available plugins are listed below.
2019-04-18 20:27:35 +05:30
| Plugin (a-z) | Lang | Deps | Description |
2019-04-18 10:29:47 +05:30
| --- | --- | --- | --- |
2019-06-07 08:44:49 +05:30
| boom | sh | SMPlayer | Play random music from dir (modify `PLAYER`) |
2019-06-23 09:18:35 +05:30
| checksum | sh | md5sum,<br>sha256sum | Create and verify checksums |
2019-04-19 19:04:20 +05:30
| fzy-edit | sh | fzy | Fuzzy find a file in directory subtree and edit in vim |
| fzy-open | sh | fzy | Fuzzy find a file in directory subtree and open using xdg-open |
| getplugs | sh | wget | Update plugins |
2019-06-01 00:17:19 +05:30
| hexview | sh | xxd | View a file in hex in `$PAGER` |
2019-04-18 10:29:47 +05:30
| imgresize | sh | [imgp](https://github.com/jarun/imgp) | Resize images in directory to screen resolution |
2019-04-18 20:58:14 +05:30
| imgur | bash | - | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) |
2019-05-24 23:14:19 +05:30
| ipinfo | sh | curl, whois | Fetch external IP address and whois information |
2019-04-18 10:29:47 +05:30
| kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device |
2019-06-03 18:26:53 +05:30
| mocplay | sh | [moc](http://moc.daper.net/) | Appends (and plays, see script) selection/dir/file in moc|
| ndiff | sh | vimdiff | Diff for selection (limited to 2 for directories) |
2019-06-01 00:17:19 +05:30
| nmount | sh | pmount, udisks2 | Toggle mount status of a device as normal user |
2019-04-18 10:29:47 +05:30
| nwal | sh | nitrogen | Set the selected image as wallpaper using nitrogen |
2019-06-07 08:44:49 +05:30
| pastebin | sh | [pastebinit](https://launchpad.net/pastebinit) | Paste contents of (text) file to paste.ubuntu.com |
2019-06-23 09:18:35 +05:30
| pdfview | sh | pdftotext/<br>mupdf-tools | View PDF file in `$PAGER` |
2019-04-18 10:29:47 +05:30
| picker | sh | nnn | Pick files and pipe the newline-separated list to another utility |
| pywal | sh | pywal | Set selected image as wallpaper, change terminal color scheme |
2019-06-23 09:18:35 +05:30
| readit | sh | pdftotext, mpv,<br>pico2wave | Read a PDF or text file aloud |
2019-06-21 22:36:34 +05:30
| ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file |
| splitjoin | sh | split, cat | Split file or join selection |
2019-04-18 20:58:14 +05:30
| sxiv | sh | sxiv | Browse images in a dir in sxiv, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))|
2019-07-12 00:03:10 +05:30
| thumb | sh | [lsix](https://github.com/hackerb9/lsix) | View thumbnail of an image or dir of images |
2019-06-07 08:44:49 +05:30
| transfer | sh | curl | Upload file to transfer.sh |
2019-04-18 10:29:47 +05:30
| upgrade | sh | wget | Upgrade to latest nnn version manually on Debian 9 Stretch |
| viuimg | sh | [viu](https://github.com/atanunq/viu), less | View an image or images in a directory |
2019-04-18 10:29:47 +05:30
2019-04-30 08:36:55 +05:30
#### Installing plugins
2019-06-20 19:10:47 +05:30
Download the `getplugs` plugin and execute it anywhere to get all the plugins installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. You can run it again later to update the plugins. It backs up earlier plugins.
2019-04-30 08:36:55 +05:30
2019-05-05 08:20:35 +05:30
**NOTE:** `getplugs` also downloads the launcher `nlaunch` and tries to place it at `/usr/local/bin/` using `sudo`. If it fails you have to place `nlauch` manually somewhere in your `$PATH`.
2019-04-30 08:36:55 +05:30
2019-04-18 20:58:14 +05:30
#### File access from plugins
2019-04-18 10:29:47 +05:30
2019-04-18 20:58:14 +05:30
Plugins can access:
2019-04-18 20:27:35 +05:30
- all files in the directory (`nnn` switches to the dir where the plugin is to be run so the dir is `$PWD` for the plugin)
2019-04-22 00:07:48 +05:30
- the current file under the cursor (the file name is passed as the argument to a plugin)
2019-06-20 19:10:47 +05:30
- the current selection (by reading the file `.selection` in config dir, see the plugin `ndiff`)
2019-04-18 10:29:47 +05:30
Each script has a _Description_ section which provides more details on what the script does, if applicable.
2019-06-03 10:27:01 +05:30
#### Usage
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.
2019-04-18 20:58:14 +05:30
#### Contributing plugins
2019-04-18 10:29:47 +05:30
2019-04-18 20:27:35 +05:30
Plugins are scripts and all scripting languages should work. However, POSIX-compliant shell scripts runnable in `sh` are preferred. If that's too rudimentary for your use case, use Python, Perl or Ruby. Please keep non-portable commands (like `notify-send`) commented so users from any other OS/DE aren't surprised.
2019-04-18 10:29:47 +05:30
2019-04-18 20:27:35 +05:30
The plugins should be executable. Please add an entry in the table above.