1
0
Fork 0
This commit is contained in:
Andrey Orst 2019-09-09 17:59:38 +03:00
parent 0319d8769c
commit 2494c9c8b5

View file

@ -15,21 +15,20 @@ Supported tools:
Git : ""git""
Default arguments:
""git ls-tree --full-tree --name-only -r HEAD""
'repo_root=$(git rev-parse --show-toplevel); git ls-tree --full-tree --name-only -r HEAD | awk ""{print \""$repo_root/\"" \$0}""'
" \
str fzf_git_command "git"
map global fzf-vcs -docstring "edit file from Git tree" 'g' '<esc>: fzf-git<ret>'
define-command -override -hidden fzf-git %{ evaluate-commands %sh{
current_path=$(pwd)
repo_root=$(git rev-parse --show-toplevel)
case $kak_opt_fzf_git_command in
(git) cmd="git ls-tree --full-tree --name-only -r HEAD" ;;
(git) cmd='repo_root=$(git rev-parse --show-toplevel); git ls-tree --full-tree --name-only -r HEAD | awk "{print \"$repo_root/\" \$0}"' ;;
(git*) cmd=$kak_opt_fzf_git_command ;;
esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map"
printf "%s\n" "fzf -kak-cmd %{cd $repo_root; edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags} -post-action %{cd $current_path}"
printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags}"
}}
§