My build of nnn with minor changes
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

README.md 5.4 KiB

5年前
5年前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Plugins extend the capabilities of `nnn`. They 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.
  2. The currently available plugins are listed below.
  3. | Plugin (a-z) | Lang | Deps | Description |
  4. | --- | --- | --- | --- |
  5. | boom | sh | [moc](http://moc.daper.net/) | Play random music from dir |
  6. | dups | sh | find, md5sum,<br>sort uniq xargs | List non-empty duplicate files in current dir |
  7. | checksum | sh | md5sum,<br>sha256sum | Create and verify checksums |
  8. | fzy-open | sh | fzy, xdg-open | Fuzzy find a file in dir subtree and edit or xdg-open |
  9. | getplugs | sh | curl | Update plugins |
  10. | hexview | sh | xxd | View a file in hex in `$PAGER` |
  11. | imgresize | sh | [imgp](https://github.com/jarun/imgp) | Resize images in dir to screen resolution |
  12. | imgur | bash | - | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) |
  13. | ipinfo | sh | curl, whois | Fetch external IP address and whois information |
  14. | kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device |
  15. | mediainf | sh | mediainfo | Show media information |
  16. | moclyrics | sh | [ddgr](https://github.com/jarun/ddgr), [moc](http://moc.daper.net/) | Show lyrics of the track playing in moc |
  17. | mocplay | sh | [moc](http://moc.daper.net/) | Appends (and plays, see script) selection/dir/file in moc|
  18. | ndiff | sh | vimdiff | Diff for selection (limited to 2 for directories) |
  19. | nmount | sh | pmount, udisks2 | Toggle mount status of a device as normal user |
  20. | notes | sh | - | Open a quick notes file/dir in `$EDITOR` |
  21. | nwal | sh | nitrogen | Set image as wallpaper using nitrogen |
  22. | oldbigfile | sh | find, sort | List large files by access time |
  23. | organize | sh | file | Auto-organize files in directories by file type |
  24. | pastebin | sh | [pastebinit](https://launchpad.net/pastebinit) | Paste contents of (text) file to paste.ubuntu.com |
  25. | pdfview | sh | pdftotext/<br>mupdf-tools | View PDF file in `$PAGER` |
  26. | picker | sh | nnn | Pick files and list one per line (to pipe) |
  27. | pywal | sh | pywal | Set image as wallpaper, change terminal colorscheme |
  28. | readit | sh | pdftotext, mpv,<br>pico2wave | Read a PDF or text file aloud |
  29. | ringtone | sh | date, ffmpeg | Create a variable bitrate mp3 ringtone from file |
  30. | splitjoin | sh | split, cat | Split file or join selection |
  31. | sxiv | sh | sxiv | View images in dir, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts))|
  32. | thumb | sh | [lsix](https://github.com/hackerb9/lsix) | View thumbnail of an image or dir of images |
  33. | transfer | sh | curl | Upload file to transfer.sh |
  34. | upgrade | sh | curl | Upgrade nnn manually on Debian 9 Stretch |
  35. | vidthumb | sh | [ffmpegthumbnailer](https://github.com/dirkvdb/ffmpegthumbnailer),<br>[lsix](https://github.com/hackerb9/lsix) | Show video thumbnails in terminal |
  36. | viuimg | sh | [viu](https://github.com/atanunq/viu), less | View an image or images in dir |
  37. ## Installing plugins
  38. The following command installs all plugins:
  39. curl -Ls https://raw.githubusercontent.com/jarun/nnn/master/plugins/getplugs | sh
  40. Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. You can run the `getplugs` plugin later to update the plugins. It backs up earlier plugins.
  41. **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`.
  42. ## Executing plugins
  43. **Method 1:** Directly with <kbd>:key</kbd>:
  44. export NNN_PLUG='o:fzy-open;p:mocplay;d:ndiff;m:nmount;n:notes;t:thumb'
  45. 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.
  46. **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.
  47. ## File access from plugins
  48. Plugins can access:
  49. - 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)
  50. - the current file under the cursor (the file name is passed as the argument to a plugin)
  51. - the current selection (by reading the file `.selection` in config dir, see the plugin `ndiff`)
  52. Each script has a _Description_ section which provides more details on what the script does, if applicable.
  53. ## Create your own plugins
  54. 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.
  55. You can create your own plugins by putting them in `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`.
  56. For example, you could create a executable shell script `git-changes`:
  57. #!/usr/bin/env sh
  58. git log -p -- "$@"
  59. And then trigger it by hitting the pick plugin key and selecting `git-changes` which will conveniently show the git log of changes to the particular file along with the code for a quick and easy review.
  60. ## Contributing plugins
  61. Please keep non-portable commands (like `notify-send`) commented so users from any other OS/DE aren't surprised.
  62. The plugins should be executable. Please add an entry in the table above.