kak: Separar sleuth a otro archivo
This commit is contained in:
parent
b77c2e0269
commit
116241fbd5
2 changed files with 26 additions and 25 deletions
|
@ -55,33 +55,12 @@ map global insert '<c-w>' '<esc>b<a-c>'
|
|||
source "%val{config}/plugins/smarttab.kak/rc/smarttab.kak"
|
||||
hook global ModuleLoaded smarttab %{
|
||||
set-option global softtabstop 4
|
||||
|
||||
source "%val{config}/sleuth.kak"
|
||||
hook -group sleuth global BufOpenFile .* %{ sleuth }
|
||||
hook -group sleuth global BufWritePost .* %{ sleuth }
|
||||
}
|
||||
|
||||
# https://github.com/mawww/kakoune/issues/2108#issuecomment-721313321
|
||||
define-command sleuth -docstring 'Heuristically set buffer options' %{
|
||||
try %{
|
||||
evaluate-commands -draft %{
|
||||
# Search the first indent level
|
||||
execute-keys 'gg' '/' '^\h+' '<ret>'
|
||||
|
||||
# Tab vs. Space
|
||||
# https://youtu.be/V7PLxL8jIl8
|
||||
try %{
|
||||
execute-keys '<a-k>' '\t' '<ret>'
|
||||
noexpandtab
|
||||
set-option buffer indentwidth 0
|
||||
} catch %{
|
||||
expandtab
|
||||
set-option buffer indentwidth %val{selection_length}
|
||||
set-option buffer softtabstop %val{selection_length}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hook -group sleuth global BufOpenFile .* %{ sleuth }
|
||||
hook -group sleuth global BufWritePost .* %{ sleuth }
|
||||
|
||||
# ------------
|
||||
# FZF
|
||||
# ------------
|
||||
|
|
22
.config/kak/sleuth.kak
Normal file
22
.config/kak/sleuth.kak
Normal file
|
@ -0,0 +1,22 @@
|
|||
# https://github.com/mawww/kakoune/issues/2108#issuecomment-721313321
|
||||
define-command sleuth -docstring 'Heuristically set buffer options' %{
|
||||
try %{
|
||||
evaluate-commands -draft %{
|
||||
# Search the first indent level
|
||||
execute-keys 'gg' '/' '^\h+' '<ret>'
|
||||
|
||||
# Tab vs. Space
|
||||
# https://youtu.be/V7PLxL8jIl8
|
||||
try %{
|
||||
execute-keys '<a-k>' '\t' '<ret>'
|
||||
noexpandtab
|
||||
set-option buffer indentwidth 0
|
||||
} catch %{
|
||||
expandtab
|
||||
set-option buffer indentwidth %val{selection_length}
|
||||
set-option buffer softtabstop %val{selection_length}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue