AutoYADM commit: 2025-06-13 14:07:05

This commit is contained in:
Daniel Fichtinger 2025-06-13 14:07:05 -04:00
parent 7fd9131e71
commit 30d07da785
3 changed files with 42 additions and 17 deletions

View file

@ -18,18 +18,39 @@ define-command editorconfig-load -params ..1 -docstring "editorconfig-load [file
file="${1:-$kak_buffile}"
filetype="$kak_opt_filetype"
# check if we have a real file or a scratch buffer
# if [ -f "$file" ]; then
# case "$filetype" in
# markdown) file="scratch.md" ;;
# python) file="scratch.py" ;;
# sh) file="scratch.sh" ;;
# bash) file="scratch.sh" ;;
# fish) file="scratch.fish" ;;
# json) file="scratch.json" ;;
# toml) file="scratch.toml" ;;
# *) file="scratch.txt" ;;
# esac
# fi
if [ ! -f "$file" ]; then
scratch="true"
# need to create .editorconfig in /tmp if it's not there
if [ ! -f "/tmp/.editorconfig" ]; then
cp "$HOME/.editorconfig" "/tmp/.editorconfig"
fi
case "$filetype" in
markdown)
file="/tmp/scratch.md"
touch "$file";;
python)
file="/tmp/scratch.py"
touch "$file";;
sh)
file="/tmp/scratch.sh"
touch "$file";;
bash)
file="/tmp/scratch.sh"
touch "$file";;
fish)
file="/tmp/scratch.fish"
touch "$file";;
json)
file="/tmp/scratch.json"
touch "$file";;
toml)
file="/tmp/scratch.toml"
touch "$file";;
*)
file="/tmp/scratch.txt"
touch "$file";;
esac
fi
case $file in
/*) # $kak_buffile is a full path that starts with a '/'
printf %s\\n "remove-hooks buffer editorconfig-hooks"
@ -69,6 +90,10 @@ define-command editorconfig-load -params ..1 -docstring "editorconfig-load [file
}
' ;;
esac
# if [ -n "$scratch" ]; then
# rm "/tmp/.editorconfig"
# rm "$file"
# fi
}
}
complete-command editorconfig-load file

View file

@ -95,7 +95,7 @@ bundle-noload kakoune-text-objects https://github.com/Delapouite/kakoune-text-ob
bundle smarttab.kak https://github.com/andreyorst/smarttab.kak %{
require-module smarttab
set-option global softtabstop 2
hook global BufCreate .* %{
hook global WinSetOption filetype=.* %{
editorconfig-load
autoconfigtab
}

View file

@ -15,18 +15,18 @@ indent_size = 4
[*.go]
indent_style = tab
[*md]
[*.md]
trim_trailing_whitespace = false
insert_final_newline = true
indent_style = space
indent_size = 2
[*yml]
[*.yml]
indent_style = space
indent_size = 2
[*typ]
[*.typ]
indent_style = space
indent_size = 2
[*fish]
[*.fish]
indent_style = space
indent_size = 4