AutoYADM commit: 2025-07-18 17:04:43

This commit is contained in:
Daniel Fichtinger 2025-07-18 17:04:43 -04:00
parent b793e169aa
commit 8f2f9512e7

View file

@ -2,6 +2,7 @@ provide-module root %∴
declare-option str-list root_globs .git .kakrc kakrc
declare-option str root_path %sh{ echo "$PWD" }
declare-option -hidden str root_prev_pwd %opt{root_path}
# recursively discovers the root dir based on root_globs
define-command root-discover %{
evaluate-commands %sh{
globs="$kak_opt_root_globs"
@ -37,36 +38,26 @@ provide-module root %∴
change-directory %opt{root_path}
echo "CWD: %opt{root_path}"
}
# TODO: return aint workin
define-command -hidden root-cd-return-impl %{
change-directory %opt{root_prev_pwd}
echo "CWD: %opt{root_prev_pwd}"
}
define-command root-cd %sh{
define-command root-cd %{
evaluate-commands %sh{
if [ "$PWD" != "$kak_opt_root_path" ]; then
echo "root-cd-root-impl"
else
echo "root-cd-return-impl"
fi
}
}
define-command -params 1 root-edit %{
edit %exp{%opt{root_path}/%arg{1}}
}
define-command just %{
root-edit justfile
}
define-command pyproject %{
root-edit pyproject.toml
}
define-command readme %{
root-edit README.md
}
alias global re root-edit
define-command kakrc %{
root-edit .kakrc
}