From 4832fc5fe1297f1241310f2453b850c72743e1bd Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Wed, 6 May 2020 18:41:01 +0530 Subject: [PATCH] Drop fzy support --- plugins/.nnn-plugin-helper | 2 +- plugins/README.md | 12 ++++++------ plugins/fzcd | 14 ++------------ plugins/fzhist | 2 -- plugins/fzopen | 6 ++---- plugins/fzz | 4 +--- plugins/launch | 4 +--- plugins/pskill | 4 +--- src/nnn.c | 11 +++++------ 9 files changed, 19 insertions(+), 40 deletions(-) diff --git a/plugins/.nnn-plugin-helper b/plugins/.nnn-plugin-helper index 0f74fc74..bcb9649f 100644 --- a/plugins/.nnn-plugin-helper +++ b/plugins/.nnn-plugin-helper @@ -15,7 +15,7 @@ export CUR_CTX ## Ask nnn to switch to directory $1 in context $2. ## If $2 is not provided, the function asks explicitly. nnn_cd () { - dir=$1 + dir="$1" if [ -z "$NNN_PIPE" ]; then echo "No pipe file found" 1>&2 diff --git a/plugins/README.md b/plugins/README.md index ff168a2d..c902a000 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -34,10 +34,10 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. | diffs | Diff for selection (limited to 2 for directories) | sh | vimdiff | | dragdrop | Drag/drop files from/into nnn | sh | [dragon](https://github.com/mwh/dragon) | | finder | Run custom find command and list | sh | - | -| fzcd | Change to the directory of a fuzzy-selected file/dir | sh | fzf/fzy
fd/fdfind/find | -| fzhist | Fuzzy-select a cmd from history, edit in `$EDITOR` and run | sh | fzf/fzy | -| fzopen | Fuzzy find a file in dir subtree and edit or open | sh | fzf/fzy, xdg-open | -| fzz | Change to any directory in the z database with fzf/fzy | sh | fzf/fzy, z | +| fzcd | Change to the directory of a fuzzy-selected file/dir | sh | fzf | +| fzhist | Fuzzy-select a cmd from history, edit in `$EDITOR` and run | sh | fzf | +| fzopen | Fuzzy find a file in dir subtree and edit or open | sh | fzf, xdg-open | +| fzz | Change to any directory in the z database with fzf | sh | fzf, z | | getplugs | Update plugins to installed `nnn` version | sh | curl | | gutenread | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m
[epr](https://github.com/wustho/epr) (optional) | | hexview | View a file in hex in `$PAGER` | sh | xxd | @@ -47,7 +47,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. | imgview | Browse images, set wallpaper, copy path ([config](https://wiki.archlinux.org/index.php/Sxiv#Assigning_keyboard_shortcuts)), [rename](https://github.com/jarun/nnn/wiki/Basic-use-cases#browse-rename-images)| sh | sxiv/[viu](https://github.com/atanunq/viu), less| | ipinfo | Fetch external IP address and whois information | sh | curl, whois | | kdeconnect | Send selected files to an Android device | sh | kdeconnect-cli | -| launch | GUI application launcher | sh | fzf/fzy | +| launch | GUI application launcher | sh | fzf | | mediainf | Show media information | sh | mediainfo | | mimelist | List files by mime in subtree | sh | fd/find | | moclyrics | Show lyrics of the track playing in moc | sh | [ddgr](https://github.com/jarun/ddgr), [moc](http://moc.daper.net/) | @@ -63,7 +63,7 @@ Plugins are installed to `${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins`. | picker | Pick files and list one per line (to pipe) | sh | nnn | | preview-tabbed | `tabbed`/xembed based file previewer | bash | _see in-file docs_ | | preview-tui | Simple TUI file previewer (needs NNN_FIFO) | sh | tmux/xterm/
\$TERMINAL, file, tree | -| pskill | Fuzzy list by name and kill process or zombie | sh | fzf/fzy, ps,
sudo/doas | +| pskill | Fuzzy list by name and kill process or zombie | sh | fzf, ps, sudo/doas | | renamer | Batch rename selection or files in dir | sh | [qmv](https://www.nongnu.org/renameutils/)/[vidir](https://joeyh.name/code/moreutils/) | | ringtone | Create a variable bitrate mp3 ringtone from file | sh | date, ffmpeg | | splitjoin | Split file or join selection | sh | split, cat | diff --git a/plugins/fzcd b/plugins/fzcd index 5e0b5f09..1925d776 100755 --- a/plugins/fzcd +++ b/plugins/fzcd @@ -1,23 +1,13 @@ #!/usr/bin/env sh -# Description: Run fzf/fzy, fd/fdfind/find and go to the directory of the file selected +# Description: Run fzf and go to the directory of the file selected # # Shell: POSIX compliant # Author: Anna Arad . "$(dirname "$0")"/.nnn-plugin-helper -if [ "$(cmd_exists fzy)" -eq "0" ]; then - if [ "$(cmd_exists fd)" -eq "0" ]; then - fd=fd - elif [ "$(cmd_exists fdfind)" -eq "0" ]; then - fd=fdfind - else - fd=find - fi - - sel=$($fd | fzy) -elif [ "$(cmd_exists fzf)" -eq "0" ]; then +if [ "$(cmd_exists fzf)" -eq "0" ]; then sel=$(fzf) else exit 1 diff --git a/plugins/fzhist b/plugins/fzhist index e5618ae9..a3aac3a3 100755 --- a/plugins/fzhist +++ b/plugins/fzhist @@ -8,8 +8,6 @@ if which fzf >/dev/null 2>&1; then fuzzy=fzf -elif which fzy >/dev/null 2>&1; then - fuzzy=fzy else exit 1 fi diff --git a/plugins/fzopen b/plugins/fzopen index a678627d..677ea26a 100755 --- a/plugins/fzopen +++ b/plugins/fzopen @@ -1,10 +1,10 @@ #!/usr/bin/env sh -# Description: Fuzzy find a file in directory subtree with fzy +# Description: Fuzzy find a file in directory subtree # Opens in $VISUAL or $EDITOR if text # Opens other type of files with xdg-open # -# Dependencies: fd/find, fzf/fzy/skim, xdg-open +# Dependencies: fd/find, fzf/skim, xdg-open # # Shell: POSIX compliant # Author: Arun Prakash Jana @@ -19,8 +19,6 @@ if which fzf >/dev/null 2>&1; then entry="$(eval "$cmd" | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)" # To show only the file name # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden) -elif which fzy >/dev/null 2>&1; then - entry=$(find . -type f 2>/dev/null | fzy) elif which sk >/dev/null 2>&1; then entry=$(find . -type f 2>/dev/null | sk) else diff --git a/plugins/fzz b/plugins/fzz index 5b402698..049cf9dc 100755 --- a/plugins/fzz +++ b/plugins/fzz @@ -9,8 +9,6 @@ if which fzf >/dev/null 2>&1; then fuzzy=fzf -elif which fzy >/dev/null 2>&1; then - fuzzy=fzy else exit 1 fi @@ -19,7 +17,7 @@ datafile="${_Z_DATA:-$HOME/.z}" if [ -f "$datafile" ]; then # I read the data from z's file instead of calling the z command so that the data doesn't need to be processed twice sel=$(awk -F "|" '{print $1}' "$datafile" | "$fuzzy" | awk '{$1=$1};1') - # NOTE: Uncomment this line and comment out the line above if you want to see the weightings of the dir's in the fzf/fzy pane + # NOTE: Uncomment this line and comment out the line above if you want to see the weightings of the dir's in the fzf pane # sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | "$fuzzy" | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1') else exit 1 diff --git a/plugins/launch b/plugins/launch index e9831407..19855f98 100755 --- a/plugins/launch +++ b/plugins/launch @@ -9,7 +9,7 @@ # # xfce4-terminal -e "${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/launch # -# Dependencies: fzf/fzy +# Dependencies: fzf # # Usage: launch [delay] # delay is in seconds, if omitted launch waits for 1 sec @@ -26,8 +26,6 @@ IFS=':' get_selection() { if which fzf >/dev/null 2>&1; then { IFS=':'; ls -H $PATH; } | sort | fzf - elif which fzy >/dev/null 2>&1; then - { IFS=':'; ls -H $PATH; } | sort | fzy else exit 1 fi diff --git a/plugins/pskill b/plugins/pskill index c23034f7..063be352 100755 --- a/plugins/pskill +++ b/plugins/pskill @@ -2,7 +2,7 @@ # Description: Fuzzy list and kill a (zombie) process by name # -# Dependencies: fzf or fzy, ps +# Dependencies: fzf, ps # # Note: To kill a zombie process enter "zombie" # @@ -24,8 +24,6 @@ if ! [ -z "$psname" ]; then if which fzf >/dev/null 2>&1; then fuzzy=fzf - elif which fzy >/dev/null 2>&1; then - fuzzy=fzy else exit 1 fi diff --git a/src/nnn.c b/src/nnn.c index 73e656ce..0bafe234 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -431,10 +431,9 @@ static uint g_states; #define UTIL_LESS 13 #define UTIL_SH 14 #define UTIL_FZF 15 -#define UTIL_FZY 16 -#define UTIL_NTFY 17 -#define UTIL_CBCP 18 -#define UTIL_NMV 19 +#define UTIL_NTFY 16 +#define UTIL_CBCP 17 +#define UTIL_NMV 18 /* Utilities to open files, run actions */ static char * const utils[] = { @@ -470,7 +469,6 @@ static char * const utils[] = { "less", "sh", "fzf", - "fzy", ".ntfy", ".cbcp", ".nmv", @@ -4287,6 +4285,7 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir) if (ctx == 0 || ctx == cfg.curctx + 1) { xstrsncpy(*lastdir, *path, PATH_MAX); xstrsncpy(*path, nextpath, PATH_MAX); + DPRINTF_S(*path); } else { r = ctx - 1; @@ -4351,7 +4350,7 @@ static void launch_app(const char *path, char *newpath) mkpath(plugindir, utils[UTIL_LAUNCH], newpath); - if (!(getutil(utils[UTIL_FZF]) || getutil(utils[UTIL_FZY])) || access(newpath, X_OK) < 0) { + if (!getutil(utils[UTIL_FZF]) || access(newpath, X_OK) < 0) { tmp = xreadline(NULL, messages[MSG_APP_NAME]); r = F_NOWAIT | F_NOTRACE | F_MULTI; }