diff options
author | Ben Sima <ben@bsima.me> | 2022-07-25 11:57:43 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2022-07-25 11:57:43 -0400 |
commit | 953fc16e402c56798f26b7c3d1f38f23560b0faa (patch) | |
tree | e2079af601b3fe7f51dcc39e721d64dda52a3ebe | |
parent | 95df71e6ce9ec3887f7e88accda7c9b29c538d86 (diff) |
Generate both emacs and vim tags
-rwxr-xr-x | Biz/Ide/ftags | 13 | ||||
-rwxr-xr-x | Biz/Ide/mktags | 26 |
2 files changed, 25 insertions, 14 deletions
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 \ |