From 7d0be597ad2791ef223cca732b9e4223879e3dbb Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 17 Nov 2019 13:08:26 +0530 Subject: Rename fzy-open to fzopen --- plugins/README.md | 8 ++++---- plugins/fzopen | 17 +++++++++++++++++ plugins/fzy-open | 17 ----------------- 3 files changed, 21 insertions(+), 21 deletions(-) create mode 100755 plugins/fzopen delete mode 100755 plugins/fzy-open (limited to 'plugins') diff --git a/plugins/README.md b/plugins/README.md index a787646..1300233 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -15,7 +15,7 @@ The currently available plugins are listed below. | 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
(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 | +| fzopen | sh | fzy, xdg-open | Fuzzy find a file in dir subtree and edit or xdg-open | | getplugs | sh | curl | Update plugins | | gutenread | sh | curl, unzip, w3m
[epr](https://github.com/wustho/epr) (optional)| Browse, download, read from Project Gutenberg | | hexview | sh | xxd | View a file in hex in `$PAGER` | @@ -67,9 +67,9 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. You ca **Method 1:** Directly with :key: - export NNN_PLUG='o:fzy-open;p:mocplay;d:ndiff;m:nmount;n:notes;v:viuimg;t:thumb' + export NNN_PLUG='o:fzopen;p:mocplay;d:ndiff;m:nmount;n:notes;v:viuimg;t:thumb' -Now plugin `fzy-open` can be run with the keybind :o, `mocplay` can be run with :p and so on... The key vs. plugin pairs are shown in the help and config screen. +Now plugin `fzopen` can be run with the keybind :o, `mocplay` can be run with :p and so on... The key vs. plugin pairs are shown in the help and config screen. **Method 2:** Use the _pick plugin_ shortcut to visit the plugin directory and execute a plugin. Repeating the same shortcut cancels the operation and puts you back in the original directory. @@ -77,7 +77,7 @@ Now plugin `fzy-open` can be run with the keybind :o, `mocplay` can b To assign keys to arbitrary non-background cli commands (non-shell-interpreted) and invoke like plugins, add `_` (underscore) before the command. For example: - export NNN_PLUG='x:_chmod +x $NNN;g:_git log;s:_smplayer $NNN;o:fzy-open' + export NNN_PLUG='x:_chmod +x $NNN;g:_git log;s:_smplayer $NNN;o:fzopen' Now :x can be used to make a file executable, :g can be used to the git log of a git project directory, :s can be used to preview a partially downloaded media file. diff --git a/plugins/fzopen b/plugins/fzopen new file mode 100755 index 0000000..97da456 --- /dev/null +++ b/plugins/fzopen @@ -0,0 +1,17 @@ +#!/usr/bin/env sh + +# Description: Fuzzy find a file in directory subtree with fzy +# Opens in $VISUAL or $EDITOR if text +# Opens other type of files with xdg-open +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +entry="$(find -type f 2>/dev/null | fzy)" + +case "$(file -biL "$entry")" in + *text*) + "${VISUAL:-$EDITOR}" "$entry" ;; + *) + xdg-open "$entry" >/dev/null 2>&1 ;; +esac diff --git a/plugins/fzy-open b/plugins/fzy-open deleted file mode 100755 index 97da456..0000000 --- a/plugins/fzy-open +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env sh - -# Description: Fuzzy find a file in directory subtree with fzy -# Opens in $VISUAL or $EDITOR if text -# Opens other type of files with xdg-open -# -# Shell: POSIX compliant -# Author: Arun Prakash Jana - -entry="$(find -type f 2>/dev/null | fzy)" - -case "$(file -biL "$entry")" in - *text*) - "${VISUAL:-$EDITOR}" "$entry" ;; - *) - xdg-open "$entry" >/dev/null 2>&1 ;; -esac -- cgit v1.2.3-70-g09d2