1
0
Fork 0

use print instead of echo

This commit is contained in:
Andrey Orst 2018-11-22 15:36:11 +03:00
parent d8ad0f7e00
commit 1652f92b72
8 changed files with 25 additions and 28 deletions

View file

@ -27,6 +27,6 @@ define-command -hidden fzf-bzr %{ evaluate-commands %sh{
cmd=$kak_opt_fzf_bzr_command ;;
esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
}}

View file

@ -27,6 +27,6 @@ define-command -hidden fzf-git %{ evaluate-commands %sh{
cmd=$kak_opt_fzf_git_command ;;
esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
}}

View file

@ -27,6 +27,6 @@ define-command -hidden fzf-hg %{ evaluate-commands %sh{
cmd=$kak_opt_fzf_hg_command ;;
esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
}}

View file

@ -2,7 +2,7 @@
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-svn.kak │
# ╞═════════════╩═════════════════════════╡
# │ Submodule for SVN support for fzf.kak │
# │ Submodule for Svn support for fzf.kak │
# ╞═══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰───────────────────────────────────────╯
@ -27,6 +27,6 @@ define-command -hidden fzf-svn %{ evaluate-commands %sh{
cmd=$kak_opt_fzf_svn_command ;;
esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
}}

View file

@ -1206,14 +1206,14 @@ define-command -hidden fzf-tag -params ..2 %{ evaluate-commands %sh{
fi
done
if [ "$path" = "$HOME" ] && [ ! -e "./${kak_opt_tagfile:-tags}" ]; then
echo "echo -markup %{{Information}No '${kak_opt_tagfile:-tags}' found}"
printf "%s\n" "echo -markup %{{Information}No '${kak_opt_tagfile:-tags}' found}"
exit
elif [ "$path" = "$HOME" ] && [ -e "./${kak_opt_tagfile:-tags}" ]; then
echo "echo -markup %{{Information}'${kak_opt_tagfile:-tags}' found at $HOME. Check if it is right tag file}"
printf "%s\n" "echo -markup %{{Information}'${kak_opt_tagfile:-tags}' found at $HOME. Check if it is right tag file}"
fi
if [ ! -z "$1" ]; then
mode=$(echo "$additional_message" | grep "<a-$1>:" | awk '{$1=""; print}' | sed "s/\(.*\)/:\1/")
mode=$(printf "%s\n" "$additional_message" | grep "<a-$1>:" | awk '{$1=""; print}' | sed "s/\(.*\)/:\1/")
cmd="cd $path; readtags -Q '(eq? \$kind \"$1\")' -l | cut -f1"
else
cmd="cd $path; readtags -l | cut -f1"
@ -1230,9 +1230,9 @@ define-command -hidden fzf-tag -params ..2 %{ evaluate-commands %sh{
Additional filters for $kak_opt_filetype filetype: $additional_message"
echo "info -title 'fzf tag$mode' '$message'"
printf "%s\n" "info -title 'fzf tag$mode' '$message'"
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
echo "set-option window ctagsfiles %{$path/${kak_opt_tagfile:-tags}}"
echo "fzf %{ctags-search} %{$cmd | awk '!a[\$0]++'} %{--expect ctrl-w $additional_flags $additional_keybindings}"
printf "%s\n" "set-option window ctagsfiles %{$path/${kak_opt_tagfile:-tags}}"
printf "%s\n" "fzf %{ctags-search} %{$cmd | awk '!a[\$0]++'} %{--expect ctrl-w $additional_flags $additional_keybindings}"
}}

View file

@ -28,7 +28,7 @@ map global fzf -docstring "open file" 'f' '<esc>: fzf-file<ret>'
define-command -hidden fzf-file %{ evaluate-commands %sh{
if [ -z "$(command -v $kak_opt_fzf_file_command)" ]; then
echo "echo -markup '{Information}''$kak_opt_fzf_file_command'' is not installed. Falling back to ''find'''"
printf "%s\n" "echo -markup '{Information}''$kak_opt_fzf_file_command'' is not installed. Falling back to ''find'''"
kak_opt_fzf_file_command="find"
fi
case $kak_opt_fzf_file_command in
@ -43,8 +43,8 @@ define-command -hidden fzf-file %{ evaluate-commands %sh{
find*|ag*|rg*|fd*)
cmd=$kak_opt_fzf_file_command ;;
*)
executable=$(echo $kak_opt_fzf_file_command | awk '{print $1'}| tr '(' ' ' | cut -d " " -f 2)
echo "echo -markup '{Information}''$executable'' is not supported by the script. fzf.kak may not work as you expect.'"
items_executable=$(printf "%s\n" "$kak_opt_fzf_file_command" | grep -o -E "[[:alpha:]]+" | head -1)
printf "%s\n" "echo -markup '{Information}''$executable'' is not supported by the script. fzf.kak may not work as you expect.'"
cmd=$kak_opt_fzf_file_command ;;
esac
title="fzf file"
@ -54,8 +54,8 @@ define-command -hidden fzf-file %{ evaluate-commands %sh{
message="Open single or multiple files.
<ret>: open file in new buffer.
<c-w>: open file in new window $additional_keybindings"
echo "info -title '$title' '$message'"
printf "%s\n" "info -title '$title' '$message'"
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
echo "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
}}

View file

@ -8,17 +8,14 @@
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
map global fzf -docstring "search in buffer" 's' '<esc>: fzf-buffer-search<ret>'
map global fzf -docstring "search in buffer" 's' '<esc>: fzf-buffer-search<ret>'
define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{
title="fzf buffer search"
message="Search buffer with fzf, and jump to result location"
echo "info -title '$title' '$message'"
line=$kak_cursor_line
char=$(expr $kak_cursor_char_column - 1)
buffer_content=$(mktemp ${TMPDIR:-/tmp}/kak-curr-buff.XXXXXX)
echo "execute-keys %{%<a-|>cat<space>><space>$buffer_content<ret>;}"
echo "execute-keys $line g $char l"
echo "fzf %{execute-keys} %{(nl -b a -n ln $buffer_content} %{--reverse | cut -f 1; rm $buffer_content; echo 'gx')}"
printf "%s\n" "info -title '$title' '$message'"
buffer_content=$(mktemp ${TMPDIR:-/tmp}/fzf-buff-${kak_buffile##*/}.XXXXXX)
printf "%s\n" "execute-keys -draft %{%<a-|>cat<space>><space>$buffer_content<ret>;}"
printf "%s\n" "fzf %{execute-keys} %{(nl -b a -n ln $buffer_content} %{--reverse | cut -f 1; rm $buffer_content; echo 'gx')}"
}}

View file

@ -38,7 +38,7 @@ bzr status"
eval $cmd >/dev/null 2>&1
res=$?
if [ "$res" = "0" ]; then
vcs=$(echo $cmd | awk '{print $1}')
vcs=$(printf "%s\n" "$cmd" | awk '{print $1}')
title="fzf $vcs"
[ ! -z "${kak_client_env_TMUX}" ] && additional_keybindings="
<c-s>: open file in horizontal split
@ -46,11 +46,11 @@ bzr status"
message="Open single or multiple files from git tree.
<ret>: open file in new buffer.
<c-w>: open file in new window $additional_keybindings"
echo "info -title '$title' '$message'"
echo "fzf-$vcs"
printf "%s\n" "info -title %{$title} %{$message}"
printf "%s\n" "fzf-$vcs"
exit
fi
done
echo "echo -markup '{Information}No VCS found in current folder'"
printf "%s\n" "echo -markup '{Information}No VCS found in current folder'"
}}