template indent width and fix tabs on yaml
This commit is contained in:
parent
622174015d
commit
ae7a622324
|
@ -13,7 +13,8 @@ variables:
|
|||
mail: disroot.org
|
||||
cursor_size: 24
|
||||
editor: kak
|
||||
tabs: false
|
||||
tabs: true
|
||||
indent_width: 4
|
||||
key_layout: colemak
|
||||
launcher: bmenu
|
||||
terminal: alacritty
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
TabWidth: 4
|
||||
IndentWidth: {{@@ indent_width @@}}
|
||||
TabWidth: {{@@ indent_width @@}}
|
||||
|
||||
{%@@ if tabs @@%}
|
||||
UseTab: ForContinuationAndIndentation
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
{%@@ if tabs @@%}
|
||||
|
||||
[filter "tabspace"]
|
||||
smudge = unexpand --tabs=4 --first-only
|
||||
clean = expand --tabs=4 --initial
|
||||
smudge = unexpand --tabs={{@@ indent_width @@}} --first-only
|
||||
clean = expand --tabs={{@@ indent_width @@}} --initial
|
||||
|
||||
{%@@ endif @@%}
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
# | . \ (_| | < (_) | |_| | | | | __/
|
||||
# |_|\_\__,_|_|\_\___/ \__,_|_| |_|\___|
|
||||
|
||||
set global tabstop 4
|
||||
set global tabstop {{@@ indent_width @@}}
|
||||
{%@@ set small_indent = [2, indent_width / 2] | max @@%}
|
||||
|
||||
hook global BufOpenFile .*\.ya?ml %{
|
||||
set buffer tabstop 2
|
||||
hook global BufOpenFile .*\.(ya?ml|c(pp)?) %{
|
||||
set buffer tabstop {{@@ small_indent @@}}
|
||||
}
|
||||
|
||||
{%@@ if tabs @@%}
|
||||
|
@ -22,18 +23,23 @@ hook global BufOpenFile .*\.ya?ml %{
|
|||
# yaml is ass and does not allow tabs for indent
|
||||
hook global BufOpenFile .*\.ya?ml %{
|
||||
execute-keys -draft '%s^\s*<ret><a-@>'
|
||||
write
|
||||
set buffer autoreload false
|
||||
} -group yaml-replace-spaces-with-tabs
|
||||
|
||||
hook global BufWritePre .*\.ya?ml %{
|
||||
execute-keys -draft '%s^\s*<ret>@'
|
||||
} -group yaml-replace-spaces-with-tabs
|
||||
hook global BufWritePost .*\.ya?ml %{ nop %sh{
|
||||
tmpf=$(mktemp)
|
||||
expand --tabs={{@@ small_indent @@}} --initial "${kak_buffile}" > "${tmpf}"
|
||||
cat "${tmpf}" > "${kak_buffile}"
|
||||
rm -- "${tmpf}"
|
||||
} } -group yaml-replace-spaces-with-tabs
|
||||
|
||||
{%@@ else @@%}
|
||||
#################################################################
|
||||
# Spaces
|
||||
#################################################################
|
||||
|
||||
set global indentwidth 4
|
||||
set global indentwidth {{@@ indent_width @@}}
|
||||
|
||||
# use spaces insted of tabs
|
||||
hook global InsertChar \t %{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# {{@@ header() @@}} #
|
||||
|
||||
tab_spaces = 4
|
||||
tab_spaces = {{@@ indent_width @@}}
|
||||
|
||||
max_width = 80
|
||||
|
||||
|
|
Loading…
Reference in New Issue