aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-16 10:36:39 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-11-16 10:36:39 +0530
commite82f6d02cdbfda3afbc66997adf15c8b4a2a5317 (patch)
treec9096acc53ac07d17eb53358d3bb519b75cf2f8a
parent2b4bd35ba66756b4b3df3678a8dfc1ee47693d7f (diff)
downloadnnn-e82f6d02cdbfda3afbc66997adf15c8b4a2a5317.tar.gz
Plugin extoggle to toggle executable status
-rw-r--r--plugins/README.md1
-rwxr-xr-xplugins/exetoggle14
2 files changed, 15 insertions, 0 deletions
diff --git a/plugins/README.md b/plugins/README.md
index fcf5140..95e2321 100644
--- a/plugins/README.md
+++ b/plugins/README.md
@@ -13,6 +13,7 @@ The currently available plugins are listed below.
| dups | sh | find, md5sum,<br>sort uniq xargs | List non-empty duplicate files in current dir |
| checksum | sh | md5sum,<br>sha256sum | Create and verify checksums |
| dragdrop | sh | [dragon](https://github.com/mwh/dragon) | Drag/drop files from/into nnn |
+| exetoggle | sh | chmod | Toggle executable status of hovered file |
| fzcd | sh | fzy/fzf<br>(optional fd) | Change to the directory of a fuzzy-selected file/dir |
| fzy-open | sh | fzy, xdg-open | Fuzzy find a file in dir subtree and edit or xdg-open |
| getplugs | sh | curl | Update plugins |
diff --git a/plugins/exetoggle b/plugins/exetoggle
new file mode 100755
index 0000000..1ad8467
--- /dev/null
+++ b/plugins/exetoggle
@@ -0,0 +1,14 @@
+#!/usr/bin/env sh
+
+# Description: Toggle executable status of hovered file
+#
+# Shell: POSIX compliant
+# Author: Arun Prakash Jana
+
+if ! [ -z "$1" ]; then
+ if [ -x "$1" ]; then
+ chmod -x "$1"
+ else
+ chmod +x "$1"
+ fi
+fi