diff --git a/.config/kak/autoload/local-kakrc.kak b/.config/kak/autoload/local-kakrc.kak index 0bc508e3..20b73c02 100644 --- a/.config/kak/autoload/local-kakrc.kak +++ b/.config/kak/autoload/local-kakrc.kak @@ -12,9 +12,14 @@ provide-module local-kakrc %— # ensures that the file exists define-command -hidden local-kakrc-ensure-file %{ nop %sh{ - if [ ! -f "$kak_opt_local_kakrc_trusted" ]; then - mkdir -p "$kak_opt_local_kakrc_trusted" - touch "$kak_opt_local_kakrc_trusted" + file="$kak_opt_local_kakrc_trusted" + dir="$(dirname "$file")" + if [ ! -f "$file" ]; then + [ ! -d "$dir" ] || mkdir -p "$dir" + base="$(basename "$file")" + # add to gitignore by default + printf '%s\n' "$base" >>"$dir/.gitignore" + touch "$file" fi } }