AutoYADM commit: 2025-07-18 18:35:39
This commit is contained in:
parent
526770c9fa
commit
8b7f528907
1 changed files with 30 additions and 5 deletions
|
@ -1,5 +1,13 @@
|
||||||
provide-module local-kakrc %—
|
provide-module local-kakrc %—
|
||||||
declare-option str local_kakrc_trusted %exp{%val{config}/local_kakrc_trusted.txt}
|
declare-option -docstring %{
|
||||||
|
Path to the list of trusted directories.
|
||||||
|
List must be a text file with one path per line.
|
||||||
|
Defaults to %exp{%val{config}/local_kakrc_trusted.txt}
|
||||||
|
} str local_kakrc_trusted %exp{%val{config}/local_kakrc_trusted.txt}
|
||||||
|
declare-option -docstring %{
|
||||||
|
Whether to automatically load .kakrc if it's trusted.
|
||||||
|
Otherwise, you must load manually with local-kakrc-load.
|
||||||
|
} bool local_kakrc_autoload false
|
||||||
|
|
||||||
# ensures that the file exists
|
# ensures that the file exists
|
||||||
define-command -hidden local-kakrc-ensure-file %{
|
define-command -hidden local-kakrc-ensure-file %{
|
||||||
|
@ -11,7 +19,10 @@ provide-module local-kakrc %—
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command local-kakrc-load-if-trusted %{
|
define-command -docstring %{
|
||||||
|
Local the .kakrc if it exists and is trusted.
|
||||||
|
If it exists but isn't trusted, notify the user.
|
||||||
|
} local-kakrc-load %{
|
||||||
# first we check if the .kakrc exists
|
# first we check if the .kakrc exists
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
if [ -f .kakrc ]; then
|
if [ -f .kakrc ]; then
|
||||||
|
@ -24,7 +35,10 @@ provide-module local-kakrc %—
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -params 0..1 local-kakrc-add-trusted %{
|
define-command -docstring %{
|
||||||
|
local-kakrc-add-trusted [<dir>]: Trust a directory. If none is
|
||||||
|
provided, the current directory is used.
|
||||||
|
} -params 0..1 local-kakrc-add-trusted %{
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
arg="$PWD"
|
arg="$PWD"
|
||||||
|
@ -37,7 +51,10 @@ provide-module local-kakrc %—
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -params 0..1 local-kakrc-rm-trusted %{
|
define-command -docstring %{
|
||||||
|
local-kakrc-add-trusted [<dir>]: Untrust a directory. If none is
|
||||||
|
provided, the current directory is used.
|
||||||
|
} -params 0..1 local-kakrc-rm-trusted %{
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
arg="$PWD"
|
arg="$PWD"
|
||||||
|
@ -69,8 +86,16 @@ provide-module local-kakrc %—
|
||||||
fd -td --exclude '.git' --base-directory "$PWD" .
|
fd -td --exclude '.git' --base-directory "$PWD" .
|
||||||
}
|
}
|
||||||
|
|
||||||
# syntax highlighting
|
# syntax highlighting for .kakrc
|
||||||
hook global BufCreate (.*/)?(\.kakrc) %{
|
hook global BufCreate (.*/)?(\.kakrc) %{
|
||||||
set-option buffer filetype kak
|
set-option buffer filetype kak
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global -once KakBegin .* %{
|
||||||
|
evaluate-commands %sh{
|
||||||
|
if [ "$kak_opt_local_kakrc_autoload" = 'true' ]; then
|
||||||
|
local-kakrc-load
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
}
|
||||||
—
|
—
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue