diff --git a/rc/extra/modeline.kak b/rc/extra/modeline.kak index 68b31acc..83af7d75 100644 --- a/rc/extra/modeline.kak +++ b/rc/extra/modeline.kak @@ -90,10 +90,13 @@ def -hidden modeline-parse-impl %{ # Add the following function to a hook on BufOpenFile to automatically parse modelines # Select the first and last `modelines` lines in the buffer, only keep modelines +# ref. options.txt (in vim `:help options`) : 2 forms of modelines: +# [text]{white}{vi:|vim:|ex:}[white]{options} +# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text] def modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{ try %{ eval -draft %{ exec \%s\`|.\' %opt{modelines}k %opt{modelines}X \ - s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+ + s^[^\s]*?\s(vim?|kak(oune)?):\s?[^\n]+ eval -draft -itersel modeline-parse-impl } } }