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

commit 14ea325ba6e7fcccc1f6e830f40ed520d4712b67
parent 148e90b366be7dbd6bfe1efbf5407577b03a2686
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu, 13 Jun 2019 14:08:27 +0200

Rewrite fuzzylaunch for POSIX sh

Diffstat:
M.local/bin/fuzzylaunch | 19++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/.local/bin/fuzzylaunch b/.local/bin/fuzzylaunch @@ -1,15 +1,20 @@ -#!/usr/bin/env zsh +#!/bin/sh +open="xdg-open" +[ "$(uname)" = "Darwin" ] && open="open" + +IFS= out=$(fzf --query="$1" --exit-0 \ + --expect=ctrl-o,ctrl-e,ctrl-y \ + --preview-window=hidden) +key=$(echo "$out" | sed 1q) +file=$(echo "$out" | sed 2q | tail -1) -IFS=$'\n' out=($(fzf --query="$1" --exit-0 --expect=ctrl-e,ctrl-o --preview-window=hidden)) -key=$(head -1 <<< "$out") -file=$(head -2 <<< "$out" | tail -1) if [ -n "$file" ]; then if [ "$key" = ctrl-e ]; then - nohup st -e ${EDITOR:-vim} "$file" >/dev/null 2>&1 & + nohup "$TERMINAL" -e "$EDITOR" "$file" >/dev/null 2>&1 & elif [ "$key" = ctrl-o ]; then - cd $(dirname "$file") && nohup st >/dev/null 2>&1 & + cd "$(dirname "$file")" && nohup "$TERMINAL" >/dev/null 2>&1 & else - nohup xdg-open "$file" >/dev/null 2>&1 & + nohup "$open" "$file" >/dev/null 2>&1 & fi sleep 0.25 fi