1
0
Fork 0

Use grep as a fallback for readtags

The `grep` query is more loose than `readtags` when a tag is given.
This commit is contained in:
robem 2020-03-18 16:14:39 -07:00
parent 5cf11c44fe
commit c71e5aaab2

View file

@ -808,17 +808,21 @@ define-command -hidden fzf-tag -params ..2 %{ evaluate-commands %sh{
printf "%s\n" "echo -markup %{{Information}'$kak_opt_fzf_tag_file_name' file found at $HOME. Check if it is right tag file}" printf "%s\n" "echo -markup %{{Information}'$kak_opt_fzf_tag_file_name' file found at $HOME. Check if it is right tag file}"
fi fi
readtags_cmd="readtags" cmd="cd $path;"
if [ ! $(command -v ${readtags_cmd}) ]; then if [ "$(command -v readtags)" ]; then
printf "%s\n" "echo -markup %{{Information}'${readtags_cmd}' executable not found. Check if '${readtags_cmd} is installed}" if [ -n "$1" ]; then
exit cmd="${cmd} readtags -t $kak_opt_fzf_tag_file_name -Q '(eq? \$kind \"$1\")' -l"
fi else
cmd="${cmd} readtags -t $kak_opt_fzf_tag_file_name -l"
if [ -n "$1" ]; then fi
cmd="cd $path; ${readtags_cmd} -t $kak_opt_fzf_tag_file_name -Q '(eq? \$kind \"$1\")' -l | cut -f1"
else else
cmd="cd $path; ${readtags_cmd} -t $kak_opt_fzf_tag_file_name -l | cut -f1" if [ -n "$1" ]; then
cmd="${cmd} grep '^\b\"$1\"\b.*\$/' $kak_opt_fzf_tag_file_name -o"
else
cmd="${cmd} grep -v '^!_TAG_*' $kak_opt_fzf_tag_file_name"
fi
fi fi
cmd="${cmd} | cut -f1"
message="Jump to a symbol''s definition message="Jump to a symbol''s definition
<ret>: open tag in new buffer <ret>: open tag in new buffer