mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Fix #813: plugin togglex - toggle exe mode for selection
This commit is contained in:
parent
a984b6a9e8
commit
1ac4b9bd5a
|
@ -130,7 +130,7 @@ It runs smoothly on the Pi, [Termux](https://www.youtube.com/embed/AbaauM7gUJw)
|
||||||
- Cross-dir file/all/range selection
|
- Cross-dir file/all/range selection
|
||||||
- Create (with parents), rename, duplicate files and dirs
|
- Create (with parents), rename, duplicate files and dirs
|
||||||
- Batch renamer for selection or dir
|
- Batch renamer for selection or dir
|
||||||
- List input file stream from stdin or plugin
|
- List input stream of file paths from stdin or plugin
|
||||||
- Copy (as), move (as), delete, archive, link selection
|
- Copy (as), move (as), delete, archive, link selection
|
||||||
- Dir updates, notification on cp, mv, rm completion
|
- Dir updates, notification on cp, mv, rm completion
|
||||||
- Copy file paths to system clipboard on select
|
- Copy file paths to system clipboard on select
|
||||||
|
|
|
@ -60,6 +60,7 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina
|
||||||
| [ringtone](ringtone) | Create a variable bitrate mp3 ringtone from file | sh | date, ffmpeg |
|
| [ringtone](ringtone) | Create a variable bitrate mp3 ringtone from file | sh | date, ffmpeg |
|
||||||
| [splitjoin](splitjoin) | Split file or join selection | sh | split, cat |
|
| [splitjoin](splitjoin) | Split file or join selection | sh | split, cat |
|
||||||
| [suedit](suedit) | Edit file using superuser permissions | sh | sudoedit/sudo/doas |
|
| [suedit](suedit) | Edit file using superuser permissions | sh | sudoedit/sudo/doas |
|
||||||
|
| [togglex](togglex) | Toggle executable mode for selection | sh | chmod |
|
||||||
| [treeview](treeview) | Informative tree output in `$EDITOR` | sh | tree |
|
| [treeview](treeview) | Informative tree output in `$EDITOR` | sh | tree |
|
||||||
| [uidgid](uidgid) | List user and group of all files in dir | sh | ls, less |
|
| [uidgid](uidgid) | List user and group of all files in dir | sh | ls, less |
|
||||||
| [upgrade](upgrade) | Upgrade nnn manually on Debian 9 Stretch | sh | curl |
|
| [upgrade](upgrade) | Upgrade nnn manually on Debian 9 Stretch | sh | curl |
|
||||||
|
|
20
plugins/togglex
Executable file
20
plugins/togglex
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Description: Toggles executable mode for selection
|
||||||
|
#
|
||||||
|
# Dependencies: chmod
|
||||||
|
#
|
||||||
|
# Note: Works _only_ with selection (nnn can toggle the mode for the hovered file)
|
||||||
|
#
|
||||||
|
# Shell: POSIX compliant
|
||||||
|
# Author: Arun Prakash Jana
|
||||||
|
|
||||||
|
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
|
||||||
|
|
||||||
|
if [ ! -s "$selection" ]; then
|
||||||
|
printf "0 selected "
|
||||||
|
read -r _
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
xargs -0 -I {} sh -c 'if [ -x {} ] ; then chmod -x {} ; else chmod +x {} ; fi' < "$selection"
|
Loading…
Reference in a new issue