aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-20 19:10:47 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-20 19:17:00 +0530
commit2d1d17616058126ef4c7e156f5925006839a822f (patch)
tree49b3ffe60d60d25280672d660cb94225532ebfdb /plugins
parent98a8eb1805f6f5df38dedb68ece57dc7b19bf52b (diff)
downloadnnn-2d1d17616058126ef4c7e156f5925006839a822f.tar.gz
Fix #288
Diffstat (limited to 'plugins')
-rw-r--r--plugins/README.md4
-rwxr-xr-xplugins/checksum2
-rwxr-xr-xplugins/getplugs11
-rwxr-xr-xplugins/kdeconnect2
-rwxr-xr-xplugins/mocplay2
-rwxr-xr-xplugins/ndiff2
-rwxr-xr-xplugins/splitjoin2
7 files changed, 14 insertions, 11 deletions
diff --git a/plugins/README.md b/plugins/README.md
index 7ab679d..7651df9 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -26,7 +26,7 @@
#### Installing plugins
-Download the `getplugs` plugin and execute it anywhere to get all the plugins installed to `~/.config/nnn/plugins`. You can run it again later to update the plugins. It backs up earlier plugins.
+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.
**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`.
@@ -35,7 +35,7 @@ Download the `getplugs` plugin and execute it anywhere to get all the plugins in
Plugins can access:
- 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)
- the current file under the cursor (the file name is passed as the argument to a plugin)
-- the current selection (by reading the file `~/.config/nnn/.selection`, see the plugin `ndiff`)
+- the current selection (by reading the file `.selection` in config dir, see the plugin `ndiff`)
Each script has a _Description_ section which provides more details on what the script does, if applicable.
diff --git a/plugins/checksum b/plugins/checksum
index 44f2274..488f9f6 100755
--- a/plugins/checksum
+++ b/plugins/checksum
@@ -12,7 +12,7 @@
# Shell: POSIX compliant
# Author: ath3
-selection=~/.config/nnn/.selection
+selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
resp=f
chsum=md5
ischksum=0
diff --git a/plugins/getplugs b/plugins/getplugs
index b460d83..a8d8ec1 100755
--- a/plugins/getplugs
+++ b/plugins/getplugs
@@ -5,13 +5,16 @@
# Shell: POSIX compliant
# Author: Arun Prakash Jana
+CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/
+PLUGIN_DIR=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins
+
# backup any earlier plugins
-if [ -d ~/.config/nnn/plugins ]; then
- tar -C ~/.config/nnn/ -cf ~/.config/nnn/"plugins-$(date '+%Y%m%d%H%M').tar.bz2" plugins/
+if [ -d $PLUGIN_DIR ]; then
+ tar -C $CONFIG_DIR -cf $CONFIG_DIR"plugins-$(date '+%Y%m%d%H%M').tar.bz2" plugins/
fi
-mkdir -p ~/.config/nnn/plugins
-cd ~/.config/nnn/plugins
+mkdir -p $PLUGIN_DIR
+cd $PLUGIN_DIR
wget -nv --show-progress https://github.com/jarun/nnn/archive/master.tar.gz
tar -xf master.tar.gz
cp -vf nnn-master/plugins/* .
diff --git a/plugins/kdeconnect b/plugins/kdeconnect
index a209f55..9ee2e60 100755
--- a/plugins/kdeconnect
+++ b/plugins/kdeconnect
@@ -5,7 +5,7 @@
# Shell: POSIX compliant
# Author: juacq97
-SELECTION=~/.config/nnn/.selection
+SELECTION=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
id=$(kdeconnect-cli -a --id-only | awk '{print $1}')
if [ "$(find "$SELECTION")" ]; then
diff --git a/plugins/mocplay b/plugins/mocplay
index 7fb6aa7..8e0f92a 100755
--- a/plugins/mocplay
+++ b/plugins/mocplay
@@ -9,7 +9,7 @@
# Shell: POSIX compliant
# Author: Arun Prakash Jana
-selection=~/.config/nnn/.selection
+selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
cmd=$(pgrep -x mocp 2>/dev/null)
ret=$cmd
diff --git a/plugins/ndiff b/plugins/ndiff
index 00dc059..9590cf4 100755
--- a/plugins/ndiff
+++ b/plugins/ndiff
@@ -8,7 +8,7 @@
# Shell: POSIX compliant
# Author: Arun Prakash Jana
-selection=~/.config/nnn/.selection
+selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
if [ -s $selection ]; then
arr=$(tr '\0' '\n' < "$selection")
diff --git a/plugins/splitjoin b/plugins/splitjoin
index 4325d3a..f79d92e 100755
--- a/plugins/splitjoin
+++ b/plugins/splitjoin
@@ -8,7 +8,7 @@
# Shell: POSIX compliant
# Author: Arun Prakash Jana
-selection=~/.config/nnn/.selection
+selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
resp=s
if [ -s "$selection" ]; then