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 b20c88cf7516dbdde5003875bd8fd638ef1b8682
parent 7aea4ba68435b18ccb440a4f2f5a9ddc1c2beb0a
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Wed, 30 Oct 2019 19:05:13 +0100

Add interactive ripgrep script

Diffstat:
A.local/bin/irg | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/.local/bin/irg b/.local/bin/irg @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# Unfortunately, the single-char read syntax is not POSIX compatible +nl=' +' +query="" +echo +while :; do + printf "%s" "> $query" + read -sN1 -r q + case "$q" in + #("$backspace") # TODO + # query="${query%?}"; q="";; + ("$nl") + f="$(echo "$out" | sed -n '$s/:.*//p')"; clear; echo "$f"; exit 0;; + esac + query="${query}${q}" + out="$(rg --column --line-number --no-heading --color=always \ + --smart-case -f <(echo "$query"))" + printf "%s\n" "$out" +done