AutoYADM commit: 2025-06-13 14:07:05
This commit is contained in:
parent
7fd9131e71
commit
30d07da785
3 changed files with 42 additions and 17 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue