This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/kak/indent.kak

44 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-12-07 19:32:45 +01:00
# {{@@ header() @@}}
# _ __ _
# | |/ /__ _| | _____ _ _ _ __ ___
# | ' // _` | |/ / _ \| | | | '_ \ / _ \
# | . \ (_| | < (_) | |_| | | | | __/
# |_|\_\__,_|_|\_\___/ \__,_|_| |_|\___|
set global tabstop 4
2020-12-11 18:13:03 +01:00
hook global BufOpenFile .*\.ya?ml %{
set buffer tabstop 2
}
2020-12-07 19:32:45 +01:00
{%@@ if tabs @@%}
#################################################################
# Tabs
#################################################################
# This means use tabs for `>` and `<`
set global indentwidth 0
# yaml is ass and does not allow tabs for indent
hook global BufOpenFile .*\.ya?ml %{
execute-keys -draft '%s^\s*<ret><a-@>'
2020-12-11 18:15:17 +01:00
} -group yaml-replace-spaces-with-tabs
2020-12-07 19:32:45 +01:00
hook global BufWritePre .*\.ya?ml %{
execute-keys -draft '%s^\s*<ret>@'
2020-12-11 18:15:17 +01:00
} -group yaml-replace-spaces-with-tabs
2020-12-07 19:32:45 +01:00
{%@@ else @@%}
#################################################################
# Spaces
#################################################################
set global indentwidth 4
# use spaces insted of tabs
hook global InsertChar \t %{
exec -draft -itersel h@
2020-12-11 18:15:17 +01:00
} -group replace-tabs-with-spaces
2020-12-07 19:32:45 +01:00
{%@@ endif @@%}