Drop fzy support

This commit is contained in:
Arun Prakash Jana 2020-05-06 18:41:01 +05:30
parent c8ecf06c51
commit 4832fc5fe1
No known key found for this signature in database
GPG key ID: A75979F35C080412
9 changed files with 19 additions and 40 deletions

View file

@ -15,7 +15,7 @@ export CUR_CTX
## Ask nnn to switch to directory $1 in context $2. ## Ask nnn to switch to directory $1 in context $2.
## If $2 is not provided, the function asks explicitly. ## If $2 is not provided, the function asks explicitly.
nnn_cd () { nnn_cd () {
dir=$1 dir="$1"
if [ -z "$NNN_PIPE" ]; then if [ -z "$NNN_PIPE" ]; then
echo "No pipe file found" 1>&2 echo "No pipe file found" 1>&2

View file

@ -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 | | 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) | | dragdrop | Drag/drop files from/into nnn | sh | [dragon](https://github.com/mwh/dragon) |
| finder | Run custom find command and list | sh | - | | finder | Run custom find command and list | sh | - |
| fzcd | Change to the directory of a fuzzy-selected file/dir | sh | fzf/fzy<br>fd/fdfind/find | | 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/fzy | | 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/fzy, xdg-open | | 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/fzy | sh | fzf/fzy, z | | fzz | Change to any directory in the z database with fzf | sh | fzf, z |
| getplugs | Update plugins to installed `nnn` version | sh | curl | | getplugs | Update plugins to installed `nnn` version | sh | curl |
| gutenread | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m<br>[epr](https://github.com/wustho/epr) (optional) | | gutenread | Browse, download, read from Project Gutenberg | sh | curl, unzip, w3m<br>[epr](https://github.com/wustho/epr) (optional) |
| hexview | View a file in hex in `$PAGER` | sh | xxd | | 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| | 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 | | ipinfo | Fetch external IP address and whois information | sh | curl, whois |
| kdeconnect | Send selected files to an Android device | sh | kdeconnect-cli | | 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 | | mediainf | Show media information | sh | mediainfo |
| mimelist | List files by mime in subtree | sh | fd/find | | 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/) | | 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 | | 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-tabbed | `tabbed`/xembed based file previewer | bash | _see in-file docs_ |
| preview-tui | Simple TUI file previewer (needs NNN_FIFO) | sh | tmux/xterm/<br>\$TERMINAL, file, tree | | preview-tui | Simple TUI file previewer (needs NNN_FIFO) | sh | tmux/xterm/<br>\$TERMINAL, file, tree |
| pskill | Fuzzy list by name and kill process or zombie | sh | fzf/fzy, ps,<br>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/) | | 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 | | ringtone | Create a variable bitrate mp3 ringtone from file | sh | date, ffmpeg |
| splitjoin | Split file or join selection | sh | split, cat | | splitjoin | Split file or join selection | sh | split, cat |

View file

@ -1,23 +1,13 @@
#!/usr/bin/env sh #!/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 # Shell: POSIX compliant
# Author: Anna Arad # Author: Anna Arad
. "$(dirname "$0")"/.nnn-plugin-helper . "$(dirname "$0")"/.nnn-plugin-helper
if [ "$(cmd_exists fzy)" -eq "0" ]; then if [ "$(cmd_exists fzf)" -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
sel=$(fzf) sel=$(fzf)
else else
exit 1 exit 1

View file

@ -8,8 +8,6 @@
if which fzf >/dev/null 2>&1; then if which fzf >/dev/null 2>&1; then
fuzzy=fzf fuzzy=fzf
elif which fzy >/dev/null 2>&1; then
fuzzy=fzy
else else
exit 1 exit 1
fi fi

View file

@ -1,10 +1,10 @@
#!/usr/bin/env sh #!/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 in $VISUAL or $EDITOR if text
# Opens other type of files with xdg-open # 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 # Shell: POSIX compliant
# Author: Arun Prakash Jana # 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)" entry="$(eval "$cmd" | fzf --delimiter / --nth=-1 --tiebreak=begin --info=hidden)"
# To show only the file name # To show only the file name
# entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tiebreak=begin --info=hidden) # 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 elif which sk >/dev/null 2>&1; then
entry=$(find . -type f 2>/dev/null | sk) entry=$(find . -type f 2>/dev/null | sk)
else else

View file

@ -9,8 +9,6 @@
if which fzf >/dev/null 2>&1; then if which fzf >/dev/null 2>&1; then
fuzzy=fzf fuzzy=fzf
elif which fzy >/dev/null 2>&1; then
fuzzy=fzy
else else
exit 1 exit 1
fi fi
@ -19,7 +17,7 @@ datafile="${_Z_DATA:-$HOME/.z}"
if [ -f "$datafile" ]; then 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 # 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') 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') # sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | "$fuzzy" | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1')
else else
exit 1 exit 1

View file

@ -9,7 +9,7 @@
# #
# xfce4-terminal -e "${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/launch # xfce4-terminal -e "${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/launch
# #
# Dependencies: fzf/fzy # Dependencies: fzf
# #
# Usage: launch [delay] # Usage: launch [delay]
# delay is in seconds, if omitted launch waits for 1 sec # delay is in seconds, if omitted launch waits for 1 sec
@ -26,8 +26,6 @@ IFS=':'
get_selection() { get_selection() {
if which fzf >/dev/null 2>&1; then if which fzf >/dev/null 2>&1; then
{ IFS=':'; ls -H $PATH; } | sort | fzf { IFS=':'; ls -H $PATH; } | sort | fzf
elif which fzy >/dev/null 2>&1; then
{ IFS=':'; ls -H $PATH; } | sort | fzy
else else
exit 1 exit 1
fi fi

View file

@ -2,7 +2,7 @@
# Description: Fuzzy list and kill a (zombie) process by name # 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" # Note: To kill a zombie process enter "zombie"
# #
@ -24,8 +24,6 @@ if ! [ -z "$psname" ]; then
if which fzf >/dev/null 2>&1; then if which fzf >/dev/null 2>&1; then
fuzzy=fzf fuzzy=fzf
elif which fzy >/dev/null 2>&1; then
fuzzy=fzy
else else
exit 1 exit 1
fi fi

View file

@ -431,10 +431,9 @@ static uint g_states;
#define UTIL_LESS 13 #define UTIL_LESS 13
#define UTIL_SH 14 #define UTIL_SH 14
#define UTIL_FZF 15 #define UTIL_FZF 15
#define UTIL_FZY 16 #define UTIL_NTFY 16
#define UTIL_NTFY 17 #define UTIL_CBCP 17
#define UTIL_CBCP 18 #define UTIL_NMV 18
#define UTIL_NMV 19
/* Utilities to open files, run actions */ /* Utilities to open files, run actions */
static char * const utils[] = { static char * const utils[] = {
@ -470,7 +469,6 @@ static char * const utils[] = {
"less", "less",
"sh", "sh",
"fzf", "fzf",
"fzy",
".ntfy", ".ntfy",
".cbcp", ".cbcp",
".nmv", ".nmv",
@ -4287,6 +4285,7 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir)
if (ctx == 0 || ctx == cfg.curctx + 1) { if (ctx == 0 || ctx == cfg.curctx + 1) {
xstrsncpy(*lastdir, *path, PATH_MAX); xstrsncpy(*lastdir, *path, PATH_MAX);
xstrsncpy(*path, nextpath, PATH_MAX); xstrsncpy(*path, nextpath, PATH_MAX);
DPRINTF_S(*path);
} else { } else {
r = ctx - 1; r = ctx - 1;
@ -4351,7 +4350,7 @@ static void launch_app(const char *path, char *newpath)
mkpath(plugindir, utils[UTIL_LAUNCH], 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]); tmp = xreadline(NULL, messages[MSG_APP_NAME]);
r = F_NOWAIT | F_NOTRACE | F_MULTI; r = F_NOWAIT | F_NOTRACE | F_MULTI;
} }