2021-03-19 18:00:49 +00:00
|
|
|
# Author: Andrey Listopadov
|
|
|
|
# Submodule for Bzr support for fzf.kak
|
|
|
|
# https://github.com/andreyorst/fzf.kak
|
2018-11-11 10:41:15 +00:00
|
|
|
|
2021-03-19 18:00:49 +00:00
|
|
|
hook global ModuleLoaded fzf-vcs %{
|
|
|
|
map global fzf-vcs -docstring "edit file from GNU Bazaar tree" 'b' '<esc>: require-module fzf-bzr; fzf-bzr<ret>'
|
|
|
|
}
|
|
|
|
|
|
|
|
provide-module fzf-bzr %§
|
2019-05-20 10:35:10 +00:00
|
|
|
|
2018-11-11 10:41:15 +00:00
|
|
|
declare-option -docstring "command to provide list of files in GNU Bazaar repository to fzf. Arguments are supported
|
|
|
|
Supported tools:
|
|
|
|
<package>: <value>:
|
|
|
|
GNU Bazaar: ""bzr""
|
|
|
|
|
|
|
|
Default arguments:
|
2019-12-19 09:03:23 +00:00
|
|
|
'(cd $repo_root && bzr ls -R --versioned)'
|
2018-11-11 10:41:15 +00:00
|
|
|
" \
|
|
|
|
str fzf_bzr_command "bzr"
|
|
|
|
|
|
|
|
define-command -hidden fzf-bzr %{ evaluate-commands %sh{
|
2019-03-17 05:09:34 +00:00
|
|
|
repo_root=$(bzr root)
|
2018-11-11 10:41:15 +00:00
|
|
|
case $kak_opt_fzf_bzr_command in
|
2019-12-19 09:03:23 +00:00
|
|
|
(bzr) cmd="(cd $repo_root && bzr ls -R --versioned)" ;;
|
|
|
|
(*) cmd=$kak_opt_fzf_bzr_command ;;
|
2018-11-11 10:41:15 +00:00
|
|
|
esac
|
2019-05-13 18:34:46 +00:00
|
|
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect $kak_opt_fzf_vertical_map --expect $kak_opt_fzf_horizontal_map"
|
2019-12-19 09:03:23 +00:00
|
|
|
printf "%s\n" "fzf -kak-cmd %{edit -existing} -items-cmd %{$cmd} -fzf-args %{-m --expect $kak_opt_fzf_window_map $additional_flags} -filter %{perl -pe \"if (/$kak_opt_fzf_window_map|$kak_opt_fzf_vertical_map|$kak_opt_fzf_horizontal_map|^$/) {} else {print \\\"$repo_root/\\\"}\"}"
|
2018-11-11 10:41:15 +00:00
|
|
|
}}
|
|
|
|
|
2019-05-09 15:12:06 +00:00
|
|
|
§
|