1
0
Fork 0
This commit is contained in:
Andrey Orst 2019-03-17 08:09:34 +03:00
parent 2e013315e4
commit f6a52fdef6
6 changed files with 17 additions and 9 deletions

View file

@ -20,6 +20,8 @@ str fzf_bzr_command "bzr"
map global fzf-vcs -docstring "edit file from GNU Bazaar tree" 'b' '<esc>: fzf-bzr<ret>'
define-command -hidden fzf-bzr %{ evaluate-commands %sh{
current_path=$(pwd)
repo_root=$(bzr root)
case $kak_opt_fzf_bzr_command in
bzr)
cmd="bzr ls -R --versioned -0" ;;
@ -27,6 +29,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"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{cd $repo_root; edit -existing} %{$cmd} %{-m --expect ctrl-w $additional_flags} %{cd $current_path}"
}}

View file

@ -19,7 +19,9 @@ str fzf_git_command "git"
map global fzf-vcs -docstring "edit file from Git tree" 'g' '<esc>: fzf-git<ret>'
define-command -hidden fzf-git %{ evaluate-commands %sh{
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" ;;
@ -27,6 +29,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"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{cd $repo_root; edit -existing} %{$cmd} %{-m --expect ctrl-w $additional_flags} %{cd $current_path}"
}}

View file

@ -20,6 +20,8 @@ str fzf_hg_command "hg"
map global fzf-vcs -docstring "edit file from mercurial tree" 'h' '<esc>: fzf-hg<ret>'
define-command -hidden fzf-hg %{ evaluate-commands %sh{
current_path=$(pwd)
repo_root=$(hg root)
case $kak_opt_fzf_hg_command in
hg)
cmd="hg locate -f -0 -I .hg locate -f -0 -I ." ;;
@ -27,6 +29,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"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{cd $repo_root; edit -existing} %{$cmd} %{-m --expect ctrl-w $additional_flags} %{cd $current_path}"
}}

View file

@ -13,20 +13,22 @@ Supported tools:
Subversion: ""svn""
Default arguments:
""svn list -R . | grep -v '$/' | tr '\\n' '\\0'""
""svn list -R $(svn info | awk -F': ' '/Working Copy Root Path: .*/ {print $2}') | grep -v '$/'""
" \
str fzf_svn_command "svn"
map global fzf-vcs -docstring "edit file from Subversion tree" 's' '<esc>: fzf-svn<ret>'
define-command -hidden fzf-svn %{ evaluate-commands %sh{
current_path=$(pwd)
repo_root=$(svn info | awk -F': ' '/Working Copy Root Path: .*/ {print $2}')
case $kak_opt_fzf_svn_command in
svn)
cmd="svn list -R . | grep -v '$/' | tr '\\n' '\\0'" ;;
cmd="svn list -R $repo_root | grep -v '$/'" ;;
svn*)
cmd=$kak_opt_fzf_svn_command ;;
esac
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{cd $repo_root; edit -existing} %{$cmd} %{-m --expect ctrl-w $additional_flags} %{cd $current_path}"
}}

View file

@ -57,6 +57,6 @@ define-command -hidden fzf-file %{ evaluate-commands %sh{
printf "%s\n" "info -title 'fzf file' '$message$tmux_keybindings'"
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
printf "%s\n" "fzf %{edit} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
printf "%s\n" "fzf %{edit -existing} %{$cmd} %{-m --expect ctrl-w $additional_flags}"
}}

View file

@ -142,7 +142,7 @@ fzf -params 2..4 %{ evaluate-commands %sh{
exit
fi
if [ $command = "edit" ] && [ $kak_opt_fzf_preview = "true" ]; then
if [ -z "${command##edit*}" ] && [ $kak_opt_fzf_preview = "true" ]; then
case $kak_opt_fzf_highlighter in
bat)
highlighter="bat --color=always --style=plain {}" ;;