diff --git a/rc/extra/modeline.kak b/rc/extra/modeline.kak index cb93b337..916b9db7 100644 --- a/rc/extra/modeline.kak +++ b/rc/extra/modeline.kak @@ -1,5 +1,5 @@ ## -## modeline.kak by lenormf +## modeline.kak bylno|\' %opt{modeline}k %opt{modeline}X ## ## Currently supported modeline format: vim @@ -7,7 +7,8 @@ ## Only a few options are supported, in order to prevent the ## buffers from poking around the configuration too much -# Amount of lines that will be checked at the beginning and the end of the buffer +# Amount of additional lines that will be checked at the beginning +# and the end of the buffer decl int modelines 5 def -hidden _modeline-parse %{ @@ -107,11 +108,9 @@ def -hidden _modeline-parse %{ # Add the following function to a hook on BufOpen to automatically parse modelines # Select the first and last `modelines` lines in the buffer, only keep modelines def modeline-parse %{ - try %{ - exec -draft "\% -s(\`(^[^\n]*\n?){%opt{modelines}})|((^[^\n]*\n?){%opt{modelines}}\') -s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+ - -:eval -draft -itersel _modeline-parse" - } + try %{ eval -draft %{ + exec \%s\`|.\' %opt{modelines}k %opt{modelines}X \ + s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+ + eval -draft -itersel _modeline-parse + } } }