# Description: Navigate to directory using jump/autojump/zoxide
#
-# Dependencies: jump - https://github.com/gsamokovarov/jump
-# OR autojump - https://github.com/wting/autojump
-# OR zoxide - https://github.com/ajeetdsouza/zoxide
+# Dependencies:
+# - jump - https://github.com/gsamokovarov/jump
+# - OR autojump - https://github.com/wting/autojump
+# - OR zoxide - https://github.com/ajeetdsouza/zoxide
#
# Note: The dependencies STORE NAVIGATION PATTERNS
#
# Usage:
# 1. Create a $BOOKMARKS_DIR directory
# By default, $BOOKMARKS_DIR is set to: ${XDG_CACHE_HOME:-$HOME/.cache}/nnn/bookmarks
-#
# 2. Create symlinks to directories
# `cd $BOOKMARKS_DIR`
# `ln -s /path/to/useful/directory bookmark_name`
# https://linux.101hacks.com/cd-command/cdpath/
#
# TODO:
-# 1. Remove `fzf` dependency
+# - Remove `fzf` dependency
#
# Shell: POSIX compliant
# Author: Todd Yamakawa
#!/usr/bin/env sh
-# Description: Play random music from current directory. Identifies MP3, FLAC, M4A, WEBM, WMA.
-# You may want to set GUIPLAYER.
+# Description: Play random music (MP3, FLAC, M4A, WEBM, WMA) from current dir.
+#
+# Dependencies: mocp (or custom)
+#
+# Note: You may want to set GUIPLAYER.
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
#!/usr/bin/env sh
-# Description: Allows for creation of multiple files/directories at the same time.
-# Plugin opens a temp file where each entry is to be written on a separate line
+# Description: Allows for creation of multiple files/dirs simultaneously
+# Creates a tmp file to write each entry in a separate line
#
# Note: Only relative paths are supported. Absolute paths are ignored
# Leading and trailing whitespace in path names is also ignored
# Description: Create and verify checksums
#
-# For selection: it will generate one file containing the checksums with file names
-# [and with paths if they are in another directory]
-# the output checksum filename will be checksum_timestamp.checksum_type
-# For file: if the file is a checksum, the plugin does the verification
+# Details:
+# - selection: it will generate one file with the checksums and filenames
+# (and with paths if they are in another directory)
+# output checksum filename format: checksum_timestamp.checksum_type
+# - file: if the file is a checksum, the plugin does the verification
# if the file is not a checksum, checksum will be generated for it
# the output checksum filename will be filename.checksum_type
-# For directory: recursively calculates checksum for all the files in the directory
+# - directory: recursively calculates checksum for all the files in the dir
# the output checksum filename will be directory.checksum_type
#
# Shell: POSIX compliant
# Description: Show diff of 2 directories or multiple files in vimdiff
#
-# Note: 1. vim may show the warning: 'Vim: Warning: Input is not from a terminal'
-# press 'Enter' to ignore and proceed.
-# 2. if only one file is in selection, the hovered file is considered as the
-# second file to diff with
+# Notes:
+# 1. vim may show the warning: 'Vim: Warning: Input is not from a terminal'
+# press 'Enter' to ignore and proceed.
+# 2. if only one file is in selection, the hovered file is considered as the
+# second file to diff with
#
# Shell: POSIX compliant
# Authors: Arun Prakash Jana, ath3
# Description: Open a Drag and drop window, to drop files onto other programs.
# Also provides drag and drop window for files.
#
-# Dependencies: https://github.com/mwh/dragon
+# Dependencies: dragon - https://github.com/mwh/dragon
#
# Notes:
-# - Files that are dropped will be added to nnn's selection
-# Some webbased files will be downloaded to current directory with curl
-# and it may overwrite some existing files
-# - The user has to mm to clear nnn's selection first
+# 1. Files that are dropped will be added to nnn's selection
+# Some web-based files will be downloaded to current dir
+# with curl and it may overwrite some existing files
+# 2. The user has to mm to clear nnn's selection first
#
# Shell: POSIX compliant
# Author: 0xACE
#!/usr/bin/env sh
-# Description: List non-empty duplicate files in the current directory (based on size followed by MD5)
+# Description: List non-empty duplicates in the current dir (based on size followed by MD5)
#
# Source: https://www.commandlinefu.com/commands/view/3555/find-duplicate-files-based-on-size-first-then-md5-hash
#
# Dependencies: find md5sum sort uniq xargs gsed
#
-# Note: bash compatible required for mktemp
+# Notes:
+# 1. If the file size exceeds $size_digits digits the file will be misplaced
+# 12 digits fit files up to 931GiB
+# 2. bash compatible required for mktemp
#
-# Shell: bash
+# Shell: Bash
# Authors: syssyphus, KlzXS
-# If the size of a file has more that $size_digits digits the file will be misplaced
-# 12 digits fit files up to 931GiB
-
EDITOR="${EDITOR:-vi}"
TMPDIR="${TMPDIR:-/tmp}"
#!/usr/bin/env sh
-# Description: Fuzzy find a command from history, edit in $EDITOR and run as a command
-# Currently supports only bash and fish history
+# Description: Fuzzy find a command from history,
+# edit in $EDITOR and run as a command
+#
+# Note: Supports only bash and fish history
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
#!/usr/bin/env sh
-# Description: Fuzzy find and execute nnn plugins (and, optionally, custom scripts located elsewhere).
-# Description and details of plugins can be previewed from the fzf interface. Use `?` to toggle preview
-# pane on and off, ^Up/^Dn to scroll.
-#
-# For better compatibility with as many nnn plugins as possible, fzplug will first execute
-# the chosen script on the file hovered in nnn, and upon failure, try to run it with no target
-# (i.e on an active selection, if present).
+# Description: Fuzzy find and execute nnn plugins (and optionally,
+# custom scripts located elsewhere).
+# Description and details of plugins can be previewed
+# from the fzf interface. Use `?` to toggle preview
+# pane on and off, ^Up/^Dn to scroll.
#
# Dependencies: find, fzf, cat (or bat, if installed)
+#
+# Note: For better compatibility with as many nnn plugins as possible,
+# fzplug will first execute the chosen script on the file hovered
+# in nnn, and upon failure, try to run it with no target (i.e on
+# an active selection, if present).
+#
# Shell: POSIX compliant
# Author: Kabouik
# Optional scripts sources
-# Leave blank or fill with the absolute path of a folder containing executable scripts other than nnn plugins
-# (e.g., "$HOME/.local/share/nautilus/scripts", since there are numerous Nautilus script git repositories).
-# Add extra variables if need be, but be sure to call them in the find command below at lines 27 and 33.
+# Leave blank or fill with the absolute path of a folder containing executable
+# scripts other than nnn plugins (e.g., "$HOME/.local/share/nautilus/scripts",
+# since there are numerous Nautilus script git repositories).
+# Add extra variables if needed, make sure you call them in the find command.
+
#CUSTOMDIR1="$HOME/.local/share/nautilus/scripts"
CUSTOMDIR1=""
CUSTOMDIR2=""
--bind="?:toggle-preview")
fi
-# Try running the script on the hovered file, and abort if no plugin was selected (ESC or ^C pressed),
+# Try running the script on the hovered file, and abort
+# abort if no plugin was selected (ESC or ^C pressed).
err=0
if ! [ "$plugin" = "" ]; then
"$plugin" "$1" || err=1
#!/usr/bin/env sh
-# Description: Decrypts selected files using gpg. The contents of the decrypted file are stored in a file with extension .dec
+# Description: Decrypts selected files using gpg. The contents of the
+# decrypted file are stored in a file with extension .dec
#
-# Note: If an appropriate private key cannot be found gpg silently prints a message in the background and no files are written.
+# Note: If an appropriate private key cannot be found gpg silently
+# prints a message in the background and no files are written.
#
# Shell: POSIX compliant
# Author: KlzXS
#!/usr/bin/env sh
-# Description: Encrypts selected files using gpg. Can encrypt either asymmetrically (key) or symmetrically (passphrase).
-# If asymmetric encryption is chosen a key can be chosen from the list of capable public keys using fzf.
+# Description: Encrypts selected files using gpg. Can encrypt
+# asymmetrically (key) or symmetrically (passphrase).
+# If asymmetric encryption is chosen a key can be
+# chosen from the list of capable public keys using fzf.
#
-# Note: symmetric encryption only works for a single (current) file as per gpg limitations
+# Note: Symmetric encryption only works for a single (current) file as per gpg limitations
#
# Shell: POSIX compliant
# Author: KlzXS
#!/usr/bin/env sh
# Description: View a file in hex
+#
# Dependencies: hx (https://github.com/krpors/hx)/xxd and $PAGER
#
# Shell: POSIX compliant
#!/usr/bin/env sh
# Description: Resize images in a directory to screen resolution with imgp
-# imgp homepage: https://github.com/jarun/imgp
+#
+# Dependencipes: imgp - https://github.com/jarun/imgp
#
# Notes:
-# 1. Set res if you don't want to be prompted for desktop resolution every time
-# 2. MINSIZE is set to 1MB by default, adjust it if you want
-# 3. imgp options used:
-# a - adaptive mode
-# c - convert PNG to JPG
-# k - skip images matching specified hres/vres
+# 1. Set res to avoid the desktop resolution prompt each time
+# 2. MINSIZE is set to 1MB by default, adjust it if you want
+# 3. imgp options used:
+# a - adaptive mode
+# c - convert PNG to JPG
+# k - skip images matching specified hres/vres
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
# Description: View thumbnail of an image or a directory of images with lsix
#
+# Dependencies: lsix
+#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
#
# Slightly modified for `nnn` integration
#
-# Shell: bash
+# Shell: Bash
# Description: Upload an image file to imgur
if [ "${1}" = "--debug" ]; then
# Description: Open images in hovered directory and thumbnails
# open hovered image in sxiv or viu and browse other images in the directory
-# Dependencies: imv (https://github.com/eXeC64/imv) or,
-# sxiv (https://github.com/muennich/sxiv) or,
-# viu (https://github.com/atanunq/viu), less
+#
+# Dependencies:
+# - imv (https://github.com/eXeC64/imv) or,
+# - sxiv (https://github.com/muennich/sxiv) or,
+# - viu (https://github.com/atanunq/viu), less
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
#!/usr/bin/env sh
-# Description: Send the selected files to your Android device using kdeconnect-cli. You must have installed and configured kdeconnect both on the Android device and on the PC.
+# Description: Send the selected files to your Android device using kdeconnect-cli.
+# kdeconnect must be configured on the Android device and the PC.
#
# Shell: POSIX compliant
# Author: juacq97
#!/usr/bin/env sh
# Description: Fetches the lyrics of the track currently playing in MOC
+#
# Dependencies: ddgr (https://github.com/jarun/ddgr)
#
# Shell: POSIX compliant
# Description: Appends and optionally plays music in MOC
#
# Notes:
-# - if selection is available, plays it, else plays the current file or directory
-# - appends tracks and exits is MOC is running, else clears playlist and adds tracks
-# - to let mocp shuffle tracks, set SHUFFLE=1
+# - if selection is available, plays it, else plays the current file or directory
+# - appends tracks and exits is MOC is running, else clears playlist and adds tracks
+# - to let mocp shuffle tracks, set SHUFFLE=1
#
# Shell: POSIX compliant
# Authors: Arun Prakash Jana, ath3
# Description: Extract audio from multimedia files and convert to mp3
#
-# Dependency: ffmpeg compiled with libmp3lame audio codec support
+# Dependencies: ffmpeg compiled with libmp3lame audio codec support
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
# 'n' integer associated to device to mount
# 'q'/'Return' exit
#
+# Dependencies: gvfs-mtp
+#
# Notes: The MTP device should be mounted at /run/user/$UID/gvfs.
# Put /run/user/$UID/gvfs to bookmark entries (NNN_BMS) for faster access.
# Make sure the device is unlocked when mounting.
# That just means the file is copied but timestamp won't be preserved.
# It's like doing `cp -p localfile.txt file-to-SMB.txt`.
#
-# Dependencies: gvfs-mtp
-#
# Shell: POSIX compliant
# Author: Benawi Adha
# If the device is not mounted, it will be mounted.
# If the device is mounted, it will be unmounted and powered down.
#
-# Runs `lsblk` if 'l' is entered, exits on 'Return`.
+# Dependencies: lsblk
#
-# Note:
-# - The script uses Linux-specific lsblk to list block devices. Alternatives:
+# Usage: Runs `lsblk` on 'l', exits on 'Return`.
+#
+# Notes:
+# - The script uses Linux-specific lsblk to list block devices. Alternatives:
# macOS: "diskutil list"
# BSD: "geom disk list"
-# - The script uses udisksctl (from udisks2) to power down devices. This is also Linux-specific.
-# Users on non-Linux platforms can comment it and use an alterntive to power-down disks.
+# - The script uses udisksctl (from udisks2) to power down devices. This is also Linux-specific.
+# Users on non-Linux platforms can comment it and use an alterntive to power-down disks.
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
#!/usr/bin/env sh
-# #############################################################################
# Description: Sample script to play files in apps by file type or mime
#
# Shell: POSIX compliant
# text/* | */xml: vi
# image/vnd.djvu): djvutxt, exiftool
#
-# ToDo:
+# TODO:
# 1. Adapt, test and enable all mimes
# 2. Clean-up the unnecessary exit codes
-# #############################################################################
# set to 1 to enable GUI apps
GUI="${GUI:-0}"
# Description: View a PDF file in pager
#
# Notes:
-# - $PAGER must be 'less -R' or 'most'
-# - To use mutool, uncomment the relevant lines and comment the pdftotext line
+# - $PAGER must be 'less -R' or 'most'
+# - To use mutool, uncomment the relevant lines and comment the pdftotext line
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
# Description: tabbed/xembed based file previewer
#
-# Note: This plugin needs a "NNN_FIFO" to work. See man.
-#
# Dependencies:
-# - tabbed (https://tools.suckless.org/tabbed): xembed host
-# - xterm (or urxvt or st) : xembed client for text-based preview
-# - mpv (https://mpv.io): xembed client for video/audio
-# - sxiv (https://github.com/muennich/sxiv): xembed client for images
-# - zathura (https://pwmt.org/projects/zathura): xembed client for PDF documents
-# - nnn's nuke plugin for text preview and fallback (should be in plugins directory)
-# nuke is a fallback for 'mpv', 'sxiv', and 'zathura', but it has has its own
-# dependencies, see the script itself
-# - vim (or any editor/pager really)
-# - file
-# - mktemp
-# - xdotool (optional, to keep main window focused)
-#
-# How to use:
-# First, install the dependencies. Then you need to set a NNN_FIFO path
-# and set a key for the plugin, then start `nnn`:
-#
-# $ NNN_FIFO=/tmp/nnn.fifo nnn
+# - tabbed (https://tools.suckless.org/tabbed): xembed host
+# - xterm (or urxvt or st) : xembed client for text-based preview
+# - mpv (https://mpv.io): xembed client for video/audio
+# - sxiv (https://github.com/muennich/sxiv): xembed client for images
+# - zathura (https://pwmt.org/projects/zathura): xembed client for PDF
+# - nnn's nuke plugin for text preview and fallback
+# nuke is a fallback for 'mpv', 'sxiv', and 'zathura', but has its
+# own dependencies, see the script for more information
+# - vim (or any editor/pager really)
+# - file
+# - mktemp
+# - xdotool (optional, to keep main window focused)
#
-# Then in `nnn`, launch the `preview-tabbed` plugin.
+# Usage:
+# - Install the dependencies. Then set a NNN_FIFO
+# and set a key for the plugin, then start `nnn`:
+# $ NNN_FIFO=/tmp/nnn.fifo nnn
+# - Launch the plugin with the designated key from nnn
#
-# If you provide the same NNN_FIFO to all nnn instances, there will be a
-# single common preview window. I you provide different FIFO path, they
-# will be independent.
+# Notes:
+# 1. This plugin needs a "NNN_FIFO" to work. See man.
+# 2. If the same NNN_FIFO is used in multiple nnn instances, there will be one
+# common preview window. With different FIFO paths, they will be independent.
#
# How it works:
# We use `tabbed` [1] as a xembed [2] host, to have a single window
# [1]: https://tools.suckless.org/tabbed/
# [2]: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html
#
-# Shell: bash (job control is weakly specified in POSIX)
+# Shell: Bash (job control is weakly specified in POSIX)
# Author: Léo Villeveygoux
# For a more extended version of this script with additional optional dependencies, see preview-tui-ext.
#
# Dependencies:
-# - Supports 4 independent methods to preview with:
-# - tmux (>=3.0), or
-# - kitty with allow_remote_control and listen_on set in kitty.conf, or
-# - QuickLook on WSL (https://github.com/QL-Win/QuickLook)
-# - $TERMINAL set to a terminal (it's xterm by default).
-# - less or $PAGER
-# - tree or exa or ls
-# - mediainfo or file
-# - mktemp
-# - unzip
-# - tar
-# - man
-# - optional: bat for code syntax highlighting
-# - optional: ueberzug, kitty terminal, viu or catimg for images.
-# - optional: scope.sh file viewer from ranger.
-# To use:
-# 1. drop scope.sh executable in $PATH
-# 2. set/export $USE_SCOPE as 1
-# - optional: pistol file viewer (https://github.com/doronbehar/pistol).
-# To use:
-# 1. install pistol
-# 2. set/export $USE_PISTOL as 1
+# - Supports 4 independent methods to preview with:
+# - tmux (>=3.0), or
+# - kitty with allow_remote_control and listen_on set in kitty.conf, or
+# - QuickLook on WSL (https://github.com/QL-Win/QuickLook)
+# - $TERMINAL set to a terminal (it's xterm by default).
+# - less or $PAGER
+# - tree or exa or ls
+# - mediainfo or file
+# - mktemp
+# - unzip
+# - tar
+# - man
+# - optional: bat for code syntax highlighting
+# - optional: ueberzug, kitty terminal, viu or catimg for images.
+# - optional: scope.sh file viewer from ranger.
+# 1. drop scope.sh executable in $PATH
+# 2. set/export $USE_SCOPE as 1
+# - optional: pistol file viewer (https://github.com/doronbehar/pistol).
+# 1. install pistol
+# 2. set/export $USE_PISTOL as 1
#
# Usage:
# You need to set a NNN_FIFO path and a key for the plugin with NNN_PLUG,
#
# $ NNN_FIFO=/tmp/nnn.fifo nnn
#
-# Then in `nnn`, launch the `preview-tui` plugin.
+# Then launch the `preview-tui` plugin in `nnn`.
#
# If you provide the same NNN_FIFO to all nnn instances, there will be a
# single common preview window. If you provide different FIFO path (e.g.
# Description: Batch rename selection or current directory with qmv
#
# Notes:
-# - Try to mimic current batch rename functionality but with correct
-# handling of edge cases by qmv or vidir.
-# Qmv opens with hidden files if no selection is used. Selected
-# directories are shown.
-# Vidir don't show directories nor hidden files.
+# - Try to mimic current batch rename functionality but with correct
+# handling of edge cases by qmv or vidir.
+# - Qmv opens with hidden files if no selection is used. Selected
+# directories are shown.
+# - Vidir don't show directories nor hidden files.
#
# Shell: POSIX compliant
# Author: José Neder
# Description: list uid and gid of files
#
# Note: To list UID and GID of all users in a pretty format, run:
-#
# cut -d':' -f1,3,4,5 < /etc/passwd | column -ts ":"
#
# Shell: POSIX compliant
#!/usr/bin/env sh
-# Description: Autodetects a nnn remote mountpoint (mounted with `c`) from any of its subfolders and allows unmounting it
-# from there without first going back to the top or entering the remote name. Also works when hovering the mountpoint
-# directly like vanilla `u`.
+# Description: Autodetects a nnn remote mountpoint (mounted with `c`)
+# from any of its subfolders and allows unmounting it
+# from the subdir without navigating to the mountppoint
+# or entering the remote name. Also works when hovering
+# the mountpoint directly like vanilla `u`.
#
# Dependencies: fusermount
+#
# Shell: POSIX compliant
# Authors: Kabouik & 0xACE
#
-# TODO: Try better avoiding lazy unmount by forcing nnn context to leave the subfolder before fusermount.
-# I tried `printf "%s" "0c$m" > "$NNN_PIPE"` but this would break nnn UI all the time, see #854.
+# TODO:
+# - Avoid lazy unmount by forcing nnn context to leave the subfolder before fusermount.
+# Tried `printf "%s" "0c$m" > "$NNN_PIPE"` but it breaks the nnn interfacee, see #854.
err=0
m=$HOME/.config/nnn/mounts
#
# Note: This script installs a package, should be issued with admin privilege
#
-# Shell: POSIX-compliant
+# Shell: POSIX compliant
# Author: Arun Prakash Jana
cur="$(nnn -v)"
# Description: Upload to Firefox Send if ffsend is found, else
# Paste contents of a text a file http://ix.io
# Upload a binary file to file.io
+#
# Dependencies: ffsend (https://github.com/timvisee/ffsend), curl, jq, tr
+#
# Note: Binary file set to expire after a week
#
# Shell: POSIX compliant
# Description: Generate video thumbnails and view them
#
# Dependencies:
-# ffmpegthumbnailer: https://github.com/dirkvdb/ffmpegthumbnailer
-# lsix: https://github.com/hackerb9/lsix
+# - ffmpegthumbnailer: https://github.com/dirkvdb/ffmpegthumbnailer
+# - lsix: https://github.com/hackerb9/lsix
#
# Shell: POSIX compliant
# Author: Arun Prakash Jana
#!/usr/bin/env sh
# Description: Set the selected image as wallpaper using nitrogen or pywal.
+#
# Usage: Hover on an image and run the script to set it as wallpaper.
#
-# Shell: POSIX Compliant
+# Shell: POSIX compliant
# Author: juacq97
if [ -n "$1" ]; then
#!/usr/bin/env sh
# Description: Copy system clipboard newline-separated file list to selection
+#
# Dependencies:
-# - tr
-# - xclip/xsel (Linux)
-# - pbpaste (macOS)
-# - termux-clipboard-get (Termux)
-# - powershell (WSL)
-# - cygwim's /dev/clipboard (Cygwin)
-# - wl-paste (Wayland)
-# - clipboard (Haiku)
+# - tr
+# - xclip/xsel (Linux)
+# - pbpaste (macOS)
+# - termux-clipboard-get (Termux)
+# - powershell (WSL)
+# - cygwim's /dev/clipboard (Cygwin)
+# - wl-paste (Wayland)
+# - clipboard (Haiku)
#
-# Limitation: breaks if a filename has newline in it
+# Note:
+# - Limitation: breaks if a filename has newline in it
#
# Shell: POSIX compliant
# Author: Léo Villeveygoux, after Arun Prakash Jana's .cbcp
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
getclip () {
-
if type xsel >/dev/null 2>&1; then
# Linux
xsel -bo
# Haiku
clipboard --print
fi
-
}
CLIPBOARD=$(getclip)
#!/usr/bin/env sh
-# Description: Sets the xdg-open's default application for the current entry's
-# file type. ${XDG_DATA_DIRS} and ${XDG_DATA_HOME} are set to the recommended
-# defaults if unset, as specified in XDG Base Directory Specification,
-# [ http://specifications.freedesktop.org/basedir-spec/ ].
+# Description: Sets the xdg-open's default application for the current entry's file
+# type. ${XDG_DATA_DIRS} and ${XDG_DATA_HOME} are set to the recommended
+# defaults if unset, as specified in XDG Base Directory Specification
+# - http://specifications.freedesktop.org/basedir-spec/.
#
# Dependencies: xdg-utils, fzf
#
-# Shell: POSIX
+# Shell: POSIX compliant
# Author: lwnctd
if [ -z "$1" ] || ! command -v fzf > /dev/null 2>& 1; then