create a file for indentation

This commit is contained in:
lelgenio 2020-12-07 15:32:45 -03:00
parent 779b14eff6
commit f820d55e99
3 changed files with 43 additions and 14 deletions

View File

@ -1,12 +1,5 @@
# {{@@ header() @@}}
# {%@@ if not tabs @@%}
# use spaces insted of tabs
hook global InsertChar \t %{
exec -draft -itersel h@
} -group kakrc-replace-tabs-with-spaces
# {%@@ endif @@%}
hook global NormalIdle .* %{ try %{
git show-diff
palette-status
@ -37,3 +30,5 @@ hook global RegisterModified '"' %{ nop %sh{
hook global BufWritePre .* %{ try %{
execute-keys -draft \%s\h+$<ret>d
} }

40
dotfiles/kak/indent.kak Normal file
View File

@ -0,0 +1,40 @@
# {{@@ header() @@}}
# _ __ _
# | |/ /__ _| | _____ _ _ _ __ ___
# | ' // _` | |/ / _ \| | | | '_ \ / _ \
# | . \ (_| | < (_) | |_| | | | | __/
# |_|\_\__,_|_|\_\___/ \__,_|_| |_|\___|
set global tabstop 4
{%@@ 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 %{
set buffer tabstop 2
execute-keys -draft '%s^\s*<ret><a-@>'
} -group kakrc-replace-spaces-with-tabs
hook global BufWritePre .*\.ya?ml %{
execute-keys -draft '%s^\s*<ret>@'
} -group kakrc-replace-spaces-with-tabs
{%@@ else @@%}
#################################################################
# Spaces
#################################################################
set global indentwidth 4
# use spaces insted of tabs
hook global InsertChar \t %{
exec -draft -itersel h@
} -group kakrc-replace-tabs-with-spaces
{%@@ endif @@%}

View File

@ -6,13 +6,6 @@
# |_|\_\__,_|_|\_\___/ \__,_|_| |_|\___|
set global tabstop 4
{%@@ if tabs @@%}
set global indentwidth 4
{%@@ else @@%}
set global indentwidth 0
{%@@ endif @@%}
set global scrolloff 8,8
add-highlighter global/ wrap
@ -20,4 +13,5 @@ source "%val{config}/plug.kak"
source "%val{config}/keys.kak"
source "%val{config}/usermode.kak"
source "%val{config}/hooks.kak"
source "%val{config}/indent.kak"
source "%val{config}/colors.kak"