Auto-detect and store the path to the root of the current repository, if any.
When a new buffer is created/opened, the script will try to use the following Version Control Systems, on after the other:
-
git
-
svn
-
hg
-
bzr
As soon as a VCS returns a path, indicating that the current buffer was created within a repository, the variable below is set.
Adding a tags
file (for use with the builtin ctags
support script)
to the ctagsfiles
option, on buffer creation:
hook global BufCreate .* %{
%sh{
if [ -e "${kak_opt_vcs_root_path}/tags" ]; then
printf 'set-option -add buffer ctagsfiles %%{%s}\n' "${kak_opt_vcs_root_path}/tags"
fi
}
}
Highlighting with a flag the lines that were changed, in a buffer, since
the last git
commit:
hook global WinCreate .* %{ evaluate-commands %sh{
if [ -n "${kak_opt_vcs_root_path}" ]; then
case "${kak_opt_vcs_name}" in
git)
echo "
git show-diff
hook global BufWritePost %val{buffile} %{git update-diff}
hook global BufReload %val{buffile} %{git update-diff}
hook global WinDisplay %val{buffile} %{git update-diff}
";;
esac
fi
} }