1
0
Fork 0
fzf.kak/rc/fzf-modules/fzf-cd.kak

32 lines
1.5 KiB
Text
Raw Normal View History

2018-11-11 10:41:15 +00:00
# ╭─────────────╥────────────────────────╮
# │ Author: ║ File: │
# │ Andrey Orst ║ fzf-cd.kak │
# ╞═════════════╩════════════════════════╡
# │ Module for changing directories with │
# │ fzf for fzf.kak plugin │
# ╞══════════════════════════════════════╡
# │ GitHub.com/andreyorst/fzf.kak │
# ╰──────────────────────────────────────╯
declare-option -docstring "command to provide list of directories to fzf.
Default value:
find: (echo .. && find \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type d -print)
" \
str fzf_cd_command "find"
map global fzf -docstring "change directory" 'c' '<esc>: fzf-cd<ret>'
define-command -hidden fzf-cd %{ evaluate-commands %sh{
title="fzf change directory"
message="Change the server''s working directory"
echo "info -title '$title' '$message'"
case $kak_opt_fzf_cd_command in
find)
cmd="(echo .. && find \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type d -print)" ;;
*)
cmd=$kak_opt_fzf_cd_command ;;
esac
echo "fzf %{change-directory \$1} %{$cmd}"
}}