From 95e1b1aa2964756ae1df022dd2f5f845ee791e34 Mon Sep 17 00:00:00 2001 From: Denis Cornehl Date: Wed, 1 Jan 2020 12:10:16 +0100 Subject: [PATCH] added ftags with preview since I want to spread the love --- Examples.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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