dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

fuzzylaunch (511B)


      1 #!/bin/sh
      2 open="xdg-open"
      3 [ "$(uname)" = "Darwin" ] && open="open"
      4 
      5 IFS= out=$(fzf --query="$1" --exit-0 \
      6 	--expect=ctrl-o,ctrl-e,ctrl-y \
      7 	--preview-window=hidden)
      8 key=$(echo "$out" | sed 1q)
      9 file=$(echo "$out" | sed 2q | tail -1)
     10 
     11 if [ -n "$file" ]; then
     12 	if [ "$key" = ctrl-e ]; then
     13 		nohup "$TERMINAL" -e "$EDITOR" "$file" >/dev/null 2>&1 &
     14 	elif [ "$key" = ctrl-o ]; then
     15 		cd "$(dirname "$file")" && nohup "$TERMINAL" >/dev/null 2>&1 &
     16 	else
     17 		nohup "$open" "$file" >/dev/null 2>&1 &
     18 	fi
     19 	sleep 0.25
     20 fi