add message if no VCS found
This commit is contained in:
parent
e9d3616321
commit
7b61eef360
1 changed files with 105 additions and 128 deletions
75
rc/fzf.kak
75
rc/fzf.kak
|
@ -140,8 +140,7 @@ Best used with mapping like:
|
||||||
" \
|
" \
|
||||||
fzf-vcs-mode %{ try %{ evaluate-commands 'enter-user-mode fzf-vcs' } }
|
fzf-vcs-mode %{ try %{ evaluate-commands 'enter-user-mode fzf-vcs' } }
|
||||||
|
|
||||||
define-command -hidden fzf-file %{
|
define-command -hidden fzf-file %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
if [ -z $(command -v $kak_opt_fzf_file_command) ]; then
|
if [ -z $(command -v $kak_opt_fzf_file_command) ]; then
|
||||||
echo "echo -markup '{Information}''$kak_opt_fzf_file_command'' is not installed. Falling back to ''find'''"
|
echo "echo -markup '{Information}''$kak_opt_fzf_file_command'' is not installed. Falling back to ''find'''"
|
||||||
kak_opt_fzf_file_command="find"
|
kak_opt_fzf_file_command="find"
|
||||||
|
@ -172,8 +171,7 @@ define-command -hidden fzf-file %{
|
||||||
echo "info -title '$title' '$message'"
|
echo "info -title '$title' '$message'"
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
||||||
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -docstring "Wrapper command for fzf vcs to automatically decect
|
define-command -docstring "Wrapper command for fzf vcs to automatically decect
|
||||||
used version control system.
|
used version control system.
|
||||||
|
@ -184,8 +182,7 @@ Supported vcs:
|
||||||
Mercurial SCM: ""hg""
|
Mercurial SCM: ""hg""
|
||||||
GNU Bazaar: ""bzr""
|
GNU Bazaar: ""bzr""
|
||||||
" \
|
" \
|
||||||
-hidden fzf-vcs %{
|
-hidden fzf-vcs %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
commands="git rev-parse --is-inside-work-tree
|
commands="git rev-parse --is-inside-work-tree
|
||||||
svn info
|
svn info
|
||||||
hg --cwd . root
|
hg --cwd . root
|
||||||
|
@ -206,74 +203,57 @@ bzr status"
|
||||||
<c-w>: open file in new window $additional_keybindings"
|
<c-w>: open file in new window $additional_keybindings"
|
||||||
echo "info -title '$title' '$message'"
|
echo "info -title '$title' '$message'"
|
||||||
echo "fzf-$vcs"
|
echo "fzf-$vcs"
|
||||||
break
|
exit
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
echo "echo -markup '{Information}No VCS found in current folder'"
|
||||||
}
|
}}
|
||||||
|
|
||||||
define-command -hidden fzf-git %{
|
define-command -hidden fzf-git %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
case $kak_opt_fzf_git_command in
|
case $kak_opt_fzf_git_command in
|
||||||
git)
|
git)
|
||||||
cmd="git ls-tree --name-only -r HEAD"
|
cmd="git ls-tree --name-only -r HEAD" ;;
|
||||||
;;
|
|
||||||
git*)
|
git*)
|
||||||
cmd=$kak_opt_fzf_git_command
|
cmd=$kak_opt_fzf_git_command ;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
||||||
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf-hg %{
|
define-command -hidden fzf-hg %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
case $kak_opt_fzf_hg_command in
|
case $kak_opt_fzf_hg_command in
|
||||||
hg)
|
hg)
|
||||||
cmd="hg locate -f -0 -I .hg locate -f -0 -I ."
|
cmd="hg locate -f -0 -I .hg locate -f -0 -I ." ;;
|
||||||
;;
|
|
||||||
hg*)
|
hg*)
|
||||||
cmd=$kak_opt_fzf_hg_command
|
cmd=$kak_opt_fzf_hg_command ;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
||||||
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf-svn %{
|
define-command -hidden fzf-svn %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
case $kak_opt_fzf_svn_command in
|
case $kak_opt_fzf_svn_command in
|
||||||
svn)
|
svn)
|
||||||
cmd="svn list -R . | grep -v '$/' | tr '\\n' '\\0'"
|
cmd="svn list -R . | grep -v '$/' | tr '\\n' '\\0'" ;;
|
||||||
;;
|
|
||||||
svn*)
|
svn*)
|
||||||
cmd=$kak_opt_fzf_svn_command
|
cmd=$kak_opt_fzf_svn_command ;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
||||||
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf-bzr %{
|
define-command -hidden fzf-bzr %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
case $kak_opt_fzf_bzr_command in
|
case $kak_opt_fzf_bzr_command in
|
||||||
bzr)
|
bzr)
|
||||||
cmd="bzr ls -R --versioned -0"
|
cmd="bzr ls -R --versioned -0" ;;
|
||||||
;;
|
|
||||||
bzr*)
|
bzr*)
|
||||||
cmd=$kak_opt_fzf_bzr_command
|
cmd=$kak_opt_fzf_bzr_command ;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
||||||
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"edit \$1\" \"$cmd\" \"-m --expect ctrl-w $additional_flags\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf-tag %{
|
define-command -hidden fzf-tag %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
case $kak_opt_fzf_tag_command in
|
case $kak_opt_fzf_tag_command in
|
||||||
readtags)
|
readtags)
|
||||||
cmd="readtags -l | cut -f1 | sort -u" ;;
|
cmd="readtags -l | cut -f1 | sort -u" ;;
|
||||||
|
@ -292,8 +272,7 @@ define-command -hidden fzf-tag %{
|
||||||
echo "info -title '$title' '$message'"
|
echo "info -title '$title' '$message'"
|
||||||
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
[ ! -z "${kak_client_env_TMUX}" ] && additional_flags="--expect ctrl-v --expect ctrl-s"
|
||||||
eval echo 'fzf \"ctags-search \$1\" \"$cmd\" \"--expect ctrl-w $additional_flags\"'
|
eval echo 'fzf \"ctags-search \$1\" \"$cmd\" \"--expect ctrl-w $additional_flags\"'
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf-cd %{
|
define-command -hidden fzf-cd %{
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
|
@ -304,8 +283,7 @@ define-command -hidden fzf-cd %{
|
||||||
fzf "change-directory $1" "(echo .. && find \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type d -print)"
|
fzf "change-directory $1" "(echo .. && find \( -path '*/.svn*' -o -path '*/.git*' \) -prune -o -type d -print)"
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden fzf-buffer-search %{
|
define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{
|
||||||
evaluate-commands %sh{
|
|
||||||
title="fzf buffer search"
|
title="fzf buffer search"
|
||||||
message="Search buffer with fzf, and jump to result location"
|
message="Search buffer with fzf, and jump to result location"
|
||||||
echo "info -title '$title' '$message'"
|
echo "info -title '$title' '$message'"
|
||||||
|
@ -315,8 +293,7 @@ define-command -hidden fzf-buffer-search %{
|
||||||
echo "execute-keys %{%<a-|>cat<space>><space>$buffer_content<ret>;}"
|
echo "execute-keys %{%<a-|>cat<space>><space>$buffer_content<ret>;}"
|
||||||
echo "execute-keys $line g $char l"
|
echo "execute-keys $line g $char l"
|
||||||
echo "fzf \"execute-keys \$1 gx\" \"(nl -b a -n ln $buffer_content\" \"--reverse | cut -f 1; rm $buffer_content)\""
|
echo "fzf \"execute-keys \$1 gx\" \"(nl -b a -n ln $buffer_content\" \"--reverse | cut -f 1; rm $buffer_content)\""
|
||||||
}
|
} }
|
||||||
}
|
|
||||||
|
|
||||||
define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
|
define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{
|
||||||
callback=$1
|
callback=$1
|
||||||
|
|
Loading…
Reference in a new issue