From 5cf11c44fe9185a4f3fa8d18705efc9bbf63fb07 Mon Sep 17 00:00:00 2001 From: robem Date: Tue, 17 Mar 2020 18:12:42 -0700 Subject: [PATCH] fzf-ctags: Check for readtags command Not every universal ctags package out there comes with the `readtags` command. Therefore, it was a bit tedious to figure out why fzf-ctags didn't work. With this change fzf-ctags will abort if readtags doesn't exist. --- rc/modules/fzf-ctags.kak | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rc/modules/fzf-ctags.kak b/rc/modules/fzf-ctags.kak index 70c1f2f..2688a7a 100644 --- a/rc/modules/fzf-ctags.kak +++ b/rc/modules/fzf-ctags.kak @@ -808,10 +808,16 @@ 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}" fi + readtags_cmd="readtags" + if [ ! $(command -v ${readtags_cmd}) ]; then + printf "%s\n" "echo -markup %{{Information}'${readtags_cmd}' executable not found. Check if '${readtags_cmd} is installed}" + exit + fi + if [ -n "$1" ]; then - cmd="cd $path; readtags -t $kak_opt_fzf_tag_file_name -Q '(eq? \$kind \"$1\")' -l | cut -f1" + cmd="cd $path; ${readtags_cmd} -t $kak_opt_fzf_tag_file_name -Q '(eq? \$kind \"$1\")' -l | cut -f1" else - cmd="cd $path; readtags -t $kak_opt_fzf_tag_file_name -l | cut -f1" + cmd="cd $path; ${readtags_cmd} -t $kak_opt_fzf_tag_file_name -l | cut -f1" fi message="Jump to a symbol''s definition