]> Sergey Matveev's repositories - nnn.git/commitdiff
Plugin extoggle to toggle executable status
authorArun Prakash Jana <engineerarun@gmail.com>
Sat, 16 Nov 2019 05:06:39 +0000 (10:36 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Sat, 16 Nov 2019 05:06:39 +0000 (10:36 +0530)
plugins/README.md
plugins/exetoggle [new file with mode: 0755]

index fcf514023bf0321ac811fcf922c2b880e5515590..95e2321ea376f334cda8865fb0561fac903c2e98 100644 (file)
@@ -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 (executable)
index 0000000..1ad8467
--- /dev/null
@@ -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