diff --git a/Examples.md b/Examples.md index 220354c..8870c86 100644 --- a/Examples.md +++ b/Examples.md @@ -678,6 +678,24 @@ ftags() { } ``` +```sh +# ftags - search ctags with preview +# only works if tags-file was generated with --excmd=number +ftags() { + local line + [ -e tags ] && + line=$( + awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' tags | + fzf \ + --nth=1,2 \ + --with-nth=2 \ + --preview-window="50%" \ + --preview="bat {3} --color=always | tail -n +\$(echo {4} | tr -d \";\\\"\")" + ) && ${EDITOR:-vim} $(cut -f3 <<< "$line") -c "set nocst" \ + -c "silent tag $(cut -f2 <<< "$line")" +} +``` + ### tmux ```zsh