diff --git a/rc/fzf-modules/VCS/fzf-bzr.kak b/rc/fzf-modules/VCS/fzf-bzr.kak index e2d7e7b..e092c06 100644 --- a/rc/fzf-modules/VCS/fzf-bzr.kak +++ b/rc/fzf-modules/VCS/fzf-bzr.kak @@ -20,6 +20,8 @@ str fzf_bzr_command "bzr" map global fzf-vcs -docstring "edit file from GNU Bazaar tree" 'b' ': fzf-bzr' 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}" }} diff --git a/rc/fzf-modules/VCS/fzf-git.kak b/rc/fzf-modules/VCS/fzf-git.kak index 102dd34..9e3d065 100644 --- a/rc/fzf-modules/VCS/fzf-git.kak +++ b/rc/fzf-modules/VCS/fzf-git.kak @@ -19,7 +19,9 @@ str fzf_git_command "git" map global fzf-vcs -docstring "edit file from Git tree" 'g' ': fzf-git' -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}" }} diff --git a/rc/fzf-modules/VCS/fzf-hg.kak b/rc/fzf-modules/VCS/fzf-hg.kak index 9912f12..8de51eb 100644 --- a/rc/fzf-modules/VCS/fzf-hg.kak +++ b/rc/fzf-modules/VCS/fzf-hg.kak @@ -20,6 +20,8 @@ str fzf_hg_command "hg" map global fzf-vcs -docstring "edit file from mercurial tree" 'h' ': fzf-hg' 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}" }} diff --git a/rc/fzf-modules/VCS/fzf-svn.kak b/rc/fzf-modules/VCS/fzf-svn.kak index ee89fc2..724228f 100644 --- a/rc/fzf-modules/VCS/fzf-svn.kak +++ b/rc/fzf-modules/VCS/fzf-svn.kak @@ -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' ': fzf-svn' 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}" }} diff --git a/rc/fzf-modules/fzf-file.kak b/rc/fzf-modules/fzf-file.kak index 4206eca..30a053c 100644 --- a/rc/fzf-modules/fzf-file.kak +++ b/rc/fzf-modules/fzf-file.kak @@ -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}" }} diff --git a/rc/fzf.kak b/rc/fzf.kak index 5453d23..6538f43 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -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 {}" ;;