Use module alias pattern for markdown dynamic loading
This commit is contained in:
parent
1adc5f080b
commit
89b50daa66
|
@ -1,3 +1,4 @@
|
||||||
|
# Detection
|
||||||
hook global BufCreate .*\.(cc|cpp|cxx|C|hh|hpp|hxx|H)$ %{
|
hook global BufCreate .*\.(cc|cpp|cxx|C|hh|hpp|hxx|H)$ %{
|
||||||
set-option buffer filetype cpp
|
set-option buffer filetype cpp
|
||||||
}
|
}
|
||||||
|
@ -58,6 +59,11 @@ hook -group objc-highlight global WinSetOption filetype=objc %{
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/objc }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/objc }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Module aliases
|
||||||
|
provide-module c %{ require-module c-family }
|
||||||
|
provide-module cpp %{ require-module c-family }
|
||||||
|
provide-module objc %{ require-module c-family }
|
||||||
|
|
||||||
|
|
||||||
provide-module c-family %§
|
provide-module c-family %§
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,9 @@ hook -group typescript-highlight global WinSetOption filetype=typescript %{
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/typescript }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/typescript }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Aliases
|
||||||
|
# ‾‾‾‾‾‾‾
|
||||||
|
provide-module typescript %{ require-module javascript }
|
||||||
|
|
||||||
provide-module javascript %§
|
provide-module javascript %§
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,14 @@ hook global WinSetOption filetype=markdown %{
|
||||||
|
|
||||||
hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line
|
hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ }
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ }
|
||||||
|
|
||||||
hook -group markdown-load buffer NormalIdle .* %{ try %{ evaluate-commands -draft %{
|
|
||||||
execute-keys '%s^\h*```\h*\K[^\n]+$<ret>'
|
|
||||||
evaluate-commands -itersel %{ require-module %val{selection} }
|
|
||||||
}}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook -group markdown-load-languages global WinSetOption filetype=markdown %{
|
||||||
|
hook window NormalIdle .* markdown-load-languages
|
||||||
|
hook window InsertIdle .* markdown-load-languages
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
hook -group markdown-highlight global WinSetOption filetype=markdown %{
|
hook -group markdown-highlight global WinSetOption filetype=markdown %{
|
||||||
add-highlighter window/markdown ref markdown
|
add-highlighter window/markdown ref markdown
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown }
|
||||||
|
@ -94,4 +95,11 @@ define-command -hidden markdown-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define-command -hidden markdown-load-languages %{
|
||||||
|
evaluate-commands -draft %{ try %{
|
||||||
|
execute-keys 'gtGbGls```\h*\K[^\s]+<ret>'
|
||||||
|
evaluate-commands -itersel %{ require-module %val{selection} }
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user