summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-12-16 07:57:39 -0500
committerBen Sima <ben@bsima.me>2021-12-21 11:01:54 -0500
commit47287f3b218e7f30e2ce5b1bdd7f6b0f3fac41ee (patch)
tree4fa04bcc416aac10b198287142d400d13f094194 /Biz
parent3fad7346721514af8bbe457abd61aab97916d2e3 (diff)
Add hoog.sh, improve ide scripts
Diffstat (limited to 'Biz')
-rwxr-xr-xBiz/Ide/ftags.sh30
-rwxr-xr-xBiz/Ide/hoog.sh14
-rwxr-xr-xBiz/Ide/init_tags.sh21
-rwxr-xr-xBiz/Ide/ns65
4 files changed, 75 insertions, 55 deletions
diff --git a/Biz/Ide/ftags.sh b/Biz/Ide/ftags.sh
index 2687e9a..4b8396b 100755
--- a/Biz/Ide/ftags.sh
+++ b/Biz/Ide/ftags.sh
@@ -1,13 +1,19 @@
#!/usr/bin/env bash
-# ftags - search ctags
-set -euo pipefail
-tags=$BIZ_ROOT/tags
-tag_search=$(
- awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' $tags \
- | cut -c1-80 \
- | fzf --nth=1,2
-)
-${EDITOR:-vim} \
- $(cut -f3 <<< "$tag_search") \
- -c "set nocst" \
- -c "silent tag $(cut -f2 <<< "$tag_search")"
+#
+# search tags with fzf
+#
+ set -euo pipefail
+ tags=$BIZ_ROOT/tags
+ tag_search=$(
+ awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' $tags \
+ | cut -c1-80 \
+ | fzf \
+ --nth=1,2 \
+ --preview-window=down \
+ --preview "rg --ignore-case --pretty --context 2 --word-regexp {+2}"
+ )
+ ${EDITOR:-vim} \
+ $(cut -f3 <<< "$tag_search") \
+ -c "set nocst" \
+ -c "silent tag $(cut -f2 <<< "$tag_search")"
+##
diff --git a/Biz/Ide/hoog.sh b/Biz/Ide/hoog.sh
new file mode 100755
index 0000000..5379e54
--- /dev/null
+++ b/Biz/Ide/hoog.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+#
+# search hoogle with fzf
+#
+ set -euo pipefail
+ HOOG="hoogle search --count=200"
+ export FZF_DEFAULT_COMMAND="$HOOG $@"
+ fzf \
+ --preview-window=down \
+ --preview "hoogle search --link --info {+2}" \
+ --bind "change:reload:$HOOG {q} || true" \
+ --print-query \
+ --ansi
+##
diff --git a/Biz/Ide/init_tags.sh b/Biz/Ide/init_tags.sh
index 10e9c85..0efc0ed 100755
--- a/Biz/Ide/init_tags.sh
+++ b/Biz/Ide/init_tags.sh
@@ -1,13 +1,12 @@
#!/usr/bin/env bash
+#
# fast-tags wrapper to generate tags automatically if there are none.
-
-flags=(
- --fully-qualified
-)
-fns=$@
-if [[ ! -r tags ]]; then
- echo Generating tags from scratch...
- exec fast-tags $flags -R .
-else
- exec fast-tags $flags $fns
-fi
+#
+ fns=$@
+ if [[ ! -r tags ]]; then
+ echo Generating tags from scratch...
+ exec fast-tags $flags -R .
+ else
+ exec fast-tags $fns
+ fi
+##
diff --git a/Biz/Ide/ns b/Biz/Ide/ns
index 6d27d46..aa4beac 100755
--- a/Biz/Ide/ns
+++ b/Biz/Ide/ns
@@ -1,33 +1,34 @@
#!/usr/bin/env bash
-
-if [[ $NOUN == "" ]]
-then
- export NOUN=$(fd --exclude=_ -t f . $BIZ_ROOT | fzf)
-fi
-
-if [[ $VERB == "" ]]
-then
- export VERB=$(fzf <<< $(sed 's/ /\n/g' <<< "edit bild push ship lint"))
-fi
-
-$VERB $NOUN
-
-printf "\nn:\tchange ns\nv:\tchange verb\nb:\tchange both\n^C:\texit\nelse:\tcontinue\n"
-read -p " ns> " -n 1 input
-
-if [[ $input == "v" ]]
-then
- unset VERB
- $0
-elif [[ $input == "n" ]]
-then
- unset NOUN
- $0
-elif [[ $input == "b" ]]
-then
- unset NOUN
- unset VERB
- $0
-else
- $0
-fi
+##
+ if [[ $NOUN == "" ]]
+ then
+ export NOUN=$(fd --exclude=_ -t f . $BIZ_ROOT | fzf)
+ fi
+##
+ if [[ $VERB == "" ]]
+ then
+ export VERB=$(fzf <<< $(sed 's/ /\n/g' <<< "edit bild push ship lint"))
+ fi
+##
+ $VERB $NOUN
+##
+ printf "\nn:\tchange ns\nv:\tchange verb\nb:\tchange both\n^C:\texit\nelse:\tcontinue\n"
+ read -p " ns> " -n 1 input
+##
+ if [[ $input == "v" ]]
+ then
+ unset VERB
+ $0
+ elif [[ $input == "n" ]]
+ then
+ unset NOUN
+ $0
+ elif [[ $input == "b" ]]
+ then
+ unset NOUN
+ unset VERB
+ $0
+ else
+ $0
+ fi
+##