summaryrefslogtreecommitdiff
path: root/Biz/Ide/ftags.sh
blob: b29d994c482efbbec0c5e4c450f95cc9bb3c4536 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
#
# search tags with fzf
#
  set -euo pipefail
  tags=${CODEROOT:?}/tags
  tag_search=$(
    awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' "$tags" \
      | cut -c1-80 \
      | fzf-tmux \
        --nth=1,2 \
        --preview-window=down,border-none \
        --bind="pgdn:preview-page-down" \
        --bind="pgup:preview-page-up" \
        --preview "rg --pretty --context 2 --fixed-strings --regexp {+2}"
  )
  ${EDITOR:-vim} \
    "$(cut -f3 <<< "$tag_search")" \
    -c "set nocst" \
    -c "silent tag $(cut -f2 <<< "$tag_search")"
##