summary refs log tree commit diff
path: root/bin/fzfez
diff options
context:
space:
mode:
Diffstat (limited to 'bin/fzfez')
-rwxr-xr-xbin/fzfez32
1 files changed, 12 insertions, 20 deletions
diff --git a/bin/fzfez b/bin/fzfez
index dff86ba..203927e 100755
--- a/bin/fzfez
+++ b/bin/fzfez
@@ -1,5 +1,7 @@
 #!/bin/sh
+
 set -e
+[ -n "$DEBUG" ] && set -x
 
 exec_hist=/tmp/fzf-interactive_exec-hist
 if [ ! -f "$exec_hist" ]; then
@@ -24,13 +26,12 @@ exec)
 	uniq "$exec_hist" \
 		| grep -v '^$' \
 		| fzf \
-			--header "${FZFEZ_HEADER:-EXEC:} select or enter a command, {} is \"${FZFEZ_EXEC_SELECTION}\"" \
+			--header "${FZFEZ_HEADER:-EXEC:} select or enter a command, {} is \"$2\"" \
 			--bind 'tab:replace-query' \
-			--bind 'esc:print-query' \
-			--bind 'enter:replace-query+accept' \
-		| tee -a $exec_hist >/dev/null \
+			--bind 'enter:print-query' \
+		| tee -a $exec_hist \
 		| sed "s#{}#$2#g"  \
-		| sh -x -s
+		| sh -s
 	exit $?
 	;;
 
@@ -51,11 +52,11 @@ _preview)
 	;;
 _preview-detach) # invoke for media files
 	case "$(xdg-mime query filetype "$2")" in
-	inode/directory)   exa -la "$2" ;;
+	inode/directory)   swx -f vifm "$2" ;;
 	image/*)           swx -f mvi "$2" ;;
 	video/*|audio/*)   swx -f mpv "$2" ;;
 	application/pdf)   swx -f zathura "$2" ;;
-	test/*)            swx -t ${EDITOR} "$2" ;;
+	text/*)            swx -t ${EDITOR} "$2" ;;
 	*)                 env FZFEZ_HEADER='PREVIEW-DETACH' $0 exec "$2" ;;
 	esac
 	;;
@@ -108,18 +109,6 @@ rg)
 			--preview "rg \"$*\" --color=always --no-filename --glob='{}' --context=5 --line-number"
 	;;
 
-vimwiki)
-	shift
-	fd -t f -e md "${1:-.*}" "$HOME/wiki" \
-		| sed "s#^$HOME/wiki/##" \
-		| sed 's#.md$##' \
-		| env FZFEZ_HEADER='VIMWIKI:' \
-			$0 \
-			--print-query \
-			--preview="$_cat -n $HOME/wiki/{}.md" \
-		| xargs -r -i nvim +VimwikiIndex +VimwikiGoto\ {}
-	;;
-
 fd)
 	shift
 	fd "$@" \
@@ -138,5 +127,8 @@ fd)
 		--bind '?:toggle-preview' \
 		--bind 'ctrl-s:toggle-sort' \
 		--bind "ctrl-space:execute(${0} _preview-detach {})" \
-		--bind "ctrl-x:execute(env FZFEZ_HEADER=EXEC: FZFEZ_EXEC_SELECTION={} ${0} exec {})+accept" "$@" ;;
+		--bind "ctrl-y:yank" \
+		--bind "ctrl-e:execute(${EDITOR} {})+abort" \
+		--bind "ctrl-x:execute(env FZFEZ_HEADER=EXEC: ${0} exec {})+abort" \
+		"$@" ;;
 esac