diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-02-10 21:26:56 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-02-10 21:26:56 +0000 |
| commit | 050484ebe0fb9d458287dec8a551c75b6a808b3d (patch) | |
| tree | 2752a5e25bc178acc058e0081c4277d05ffdab9c | |
| parent | 8b7025b8eaf493da26fe5c2ec65fbbfd31b79eb3 (diff) | |
Slight cleanup in modeline.kak
| -rw-r--r-- | rc/extra/modeline.kak | 17 |
1 files changed, 8 insertions, 9 deletions
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|\'<ret> %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}}\')<ret> -s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+<ret> -<a-s> -:eval -draft -itersel _modeline-parse<ret>" - } + try %{ eval -draft %{ + exec \%s\`|.\'<ret> %opt{modelines}k <a-x> %opt{modelines}X \ + s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+<ret> + eval -draft -itersel _modeline-parse + } } } |
