AutoYADM commit: 2025-07-18 18:20:13
This commit is contained in:
parent
360560fd2b
commit
526770c9fa
2 changed files with 14 additions and 15 deletions
|
@ -15,9 +15,7 @@ provide-module local-kakrc %—
|
|||
# first we check if the .kakrc exists
|
||||
evaluate-commands %sh{
|
||||
if [ -f .kakrc ]; then
|
||||
notify-send "Found it!"
|
||||
# check if it's a trusted dir
|
||||
if grep -q "$PWD" "$kak_opt_local_kakrc_trusted"; then
|
||||
if grep -qFx "$PWD" "$kak_opt_local_kakrc_trusted"; then
|
||||
echo "source .kakrc"
|
||||
else
|
||||
echo "info -title 'local-kakrc' 'Local .kakrc found, but directory is untrusted.'"
|
||||
|
@ -27,14 +25,15 @@ provide-module local-kakrc %—
|
|||
}
|
||||
|
||||
define-command -params 0..1 local-kakrc-add-trusted %{
|
||||
nop %sh{
|
||||
evaluate-commands %sh{
|
||||
if [ "$#" -eq 0 ]; then
|
||||
arg="$PWD"
|
||||
else
|
||||
arg="$(realpath "$1")"
|
||||
fi
|
||||
echo "local-kakrc-ensure-file">"$kak_command_fifo"
|
||||
printf '%s\n' "$arg">"$kak_opt_local_kakrc_trusted"
|
||||
printf 'info -title "local-kakrc" "Adding %s to trusted"' "$arg"
|
||||
printf '%s\n' "$arg">>"$kak_opt_local_kakrc_trusted"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,26 +50,27 @@ provide-module local-kakrc %—
|
|||
fi
|
||||
temp="$(mktemp)"
|
||||
touch "$temp"
|
||||
if grep -vxF "$arg" "$kak_opt_local_kakrc_trusted" >"$temp"; then
|
||||
mv -f "$temp" "$kak_opt_local_kakrc_trusted"
|
||||
# check if path is in file
|
||||
if grep -qFx "$arg" "$kak_opt_local_kakrc_trusted"; then
|
||||
# perform removal
|
||||
grep -vxF "$arg" "$kak_opt_local_kakrc_trusted" >"$temp"
|
||||
mv -f "$temp" "$kak_opt_local_kakrc_trusted"
|
||||
else
|
||||
notify-send "this runs"
|
||||
echo "info -title 'local-kakrc' 'No such trusted directory!'"
|
||||
echo "info -title 'local-kakrc' 'No such trusted directory!'"
|
||||
rm "$temp" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
}
|
||||
complete-command local-kakrc-rm-trusted shell-script-candidates %{
|
||||
cat "$kak_opt_local_kakrc_trusted"
|
||||
}
|
||||
|
||||
complete-command local-kakrc-add-trusted shell-script-candidates %{
|
||||
fd -td --exclude '.git' --base-directory "$PWD" .
|
||||
}
|
||||
|
||||
# syntax highlighting
|
||||
hook global BufCreate (.*/)?\.kakrc %{
|
||||
hook global BufCreate (.*/)?(\.kakrc) %{
|
||||
set-option buffer filetype kak
|
||||
}
|
||||
# load proj. config
|
||||
define-command root-load-kakrc %{
|
||||
try %{ source %exp{%opt{root_path}/.kakrc} }
|
||||
}
|
||||
—
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
/home/fic/Documents
|
||||
/tmp/kak-trusted
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue