mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-29 01:24:52 +03:00
Get rid of the modeline
option to let users set hooks manually
This commit is contained in:
parent
94674b63e0
commit
507ed69dda
@ -7,8 +7,6 @@
|
||||
## Only a few options are supported, in order to prevent the
|
||||
## buffers from poking around the configuration too much
|
||||
|
||||
# Set to 'true' to parse modelines in buffers
|
||||
decl bool modeline "true"
|
||||
# Amount of lines that will be checked at the beginning and the end of the buffer
|
||||
decl int modelines 5
|
||||
|
||||
@ -106,8 +104,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 -hidden _modeline-crunch %{
|
||||
def modeline-parse %{
|
||||
try %{
|
||||
exec -draft "\%
|
||||
s(\`(^[^\n]*\n?){%opt{modelines}})|((^[^\n]*\n?){%opt{modelines}}\')<ret>
|
||||
@ -116,11 +115,3 @@ s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+<ret>
|
||||
:eval -draft -itersel _modeline-parse<ret>"
|
||||
}
|
||||
}
|
||||
|
||||
hook global BufOpen .* %{
|
||||
%sh{
|
||||
if [ "${kak_opt_modeline}" = true ]; then
|
||||
echo "eval _modeline-crunch"
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user