"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/fzopen" between
nnn-v4.1.1.tar.gz and nnn-v4.2.tar.gz

About: nnn is a full-featured terminal file manager.

fzopen  (nnn-v4.1.1):fzopen  (nnn-v4.2)
skipping to change at line 15 skipping to change at line 15
# 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.
# Work only with a single file selected. # Work only with a single file selected.
# #
# Picker mode: # Picker mode:
# If picker mode output file is passed, it # If picker mode output file is passed, it
# will be overwritten with any picked files. # will be overwritten with any picked files.
# Leaves untouched if no file is picked. # Leaves untouched if no file is picked.
# Works with single/multiple files selected. # Works with single/multiple files selected.
# #
# Dependencies: fd/find, fzf/skim, xdg-open # Dependencies: fd/find, fzf/skim, xdg-open/open (on macOS)
# #
# Shell: POSIX compliant # Shell: POSIX compliant
# Author: Arun Prakash Jana # Author: Arun Prakash Jana
NUKE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/plugins/nuke"
USE_NUKE=0
. "$(dirname "$0")"/.nnn-plugin-helper . "$(dirname "$0")"/.nnn-plugin-helper
if type fzf >/dev/null 2>&1; then if type fzf >/dev/null 2>&1; then
cmd="$FZF_DEFAULT_COMMAND" cmd="$FZF_DEFAULT_COMMAND"
if type fd >/dev/null 2>&1; then if type fd >/dev/null 2>&1; then
[ -z "$cmd" ] && cmd="fd -t f 2>/dev/null" [ -z "$cmd" ] && cmd="fd -t f 2>/dev/null"
else else
[ -z "$cmd" ] && cmd="find . -type f 2>/dev/null" [ -z "$cmd" ] && cmd="find . -type f 2>/dev/null"
fi fi
entry="$(eval "$cmd" | fzf -m --delimiter / --nth=-1 --tiebreak=begin --info =hidden)" entry="$(eval "$cmd" | fzf -m)"
# To show only the file name # To show only the file name
# entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tie break=begin --info=hidden) # entry=$(find . -type f 2>/dev/null | fzf --delimiter / --with-nth=-1 --tie break=begin --info=hidden)
elif type sk >/dev/null 2>&1; then elif type sk >/dev/null 2>&1; then
entry=$(find . -type f 2>/dev/null | sk) entry=$(find . -type f 2>/dev/null | sk)
else else
exit 1 exit 1
fi fi
# Check for picker mode # Check for picker mode
if [ "$3" ]; then if [ "$3" ]; then
skipping to change at line 54 skipping to change at line 57
printf "%s\n" "$entry" > "$3" printf "%s\n" "$entry" > "$3"
fi fi
# Tell `nnn` to clear its internal selection # Tell `nnn` to clear its internal selection
printf "%s" "0p" > "$NNN_PIPE" printf "%s" "0p" > "$NNN_PIPE"
fi fi
exit 0 exit 0
fi fi
if [ "$USE_NUKE" -ne 0 ]; then
"$NUKE" "$entry"
exit 0
fi
# Open the file (works for a single file only) # Open the file (works for a single file only)
case "$(file -biL "$entry")" in cmd_file=""
cmd_open=""
if uname | grep -q "Darwin"; then
cmd_file="file -bIL"
cmd_open="open"
else
cmd_file="file -biL"
cmd_open="xdg-open"
fi
case "$($cmd_file "$entry")" in
*text*) *text*)
"${VISUAL:-$EDITOR}" "$entry" ;; "${VISUAL:-$EDITOR}" "$entry" ;;
*) *)
if uname | grep -q "Darwin"; then $cmd_open "$entry" >/dev/null 2>&1 ;;
open "$entry" >/dev/null 2>&1
else
xdg-open "$entry" >/dev/null 2>&1
fi
;;
esac esac
 End of changes. 6 change blocks. 
9 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)