1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-14 02:44:35 +03:00

ref vim options.txt

This commit is contained in:
Nicholas Ochiel 2017-10-15 05:22:38 +03:00
parent c702c915c1
commit 24e9b86562

View File

@ -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\`|.\'<ret> %opt{modelines}k <a-x> %opt{modelines}X \
s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
s^[^\s]*?\s(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
eval -draft -itersel modeline-parse-impl
} }
}