From 953fc16e402c56798f26b7c3d1f38f23560b0faa Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 25 Jul 2022 11:57:43 -0400 Subject: Generate both emacs and vim tags --- Biz/Ide/ftags | 13 +++++-------- Biz/Ide/mktags | 26 ++++++++++++++++++++------ 2 files changed, 25 insertions(+), 14 deletions(-) (limited to 'Biz') diff --git a/Biz/Ide/ftags b/Biz/Ide/ftags index 6899faa..929399f 100755 --- a/Biz/Ide/ftags +++ b/Biz/Ide/ftags @@ -3,19 +3,16 @@ # search tags with fzf # set -euo pipefail - if [[ "$EDITOR" =~ ^emacs ]]; then - echo "error: emacs tags not supported" - exit 1 - else - tags=$BIZ_ROOT/tags - fi + tags=$BIZ_ROOT/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 \ - --preview "rg --ignore-case --pretty --context 2 --word-regexp {+2}" + --preview-window=right \ + --bind="pgdn:preview-page-down" \ + --bind="pgup:preview-page-up" \ + --preview "rg --pretty --context 2 --word-regexp -F {+2}" ) ${EDITOR:-vim} \ "$(cut -f3 <<< "$tag_search")" \ diff --git a/Biz/Ide/mktags b/Biz/Ide/mktags index b5b55c7..c8c1f99 100755 --- a/Biz/Ide/mktags +++ b/Biz/Ide/mktags @@ -4,13 +4,27 @@ # set -euxo pipefail files=$@ - tags=$BIZ_ROOT/tags - flags=() - if [[ "$EDITOR" =~ ^emacs ]]; then - flags+=("-e") + vimtags=$BIZ_ROOT/tags + emacstags=$BIZ_ROOT/TAGS +# + if [[ ! -r $emacstags ]]; then + echo Generating emacs TAGS from scratch... + fast-tags -e -R $BIZ_ROOT + ctags -e \ + --append=yes \ + --recurse=yes \ + --exclude="$BIZ_ROOT/_/*" \ + $BIZ_ROOT + else + fast-tags -e $files + ctags -e \ + --append=yes \ + --exclude="_/*" \ + $files fi - if [[ ! -r $tags ]]; then - echo Generating tags from scratch... +# + if [[ ! -r $vimtags ]]; then + echo Generating vim tags from scratch... fast-tags "${flags[@]}" -R $BIZ_ROOT ctags "${flags[@]}" \ --append=yes \ -- cgit v1.2.3