From c0dccdd90dd615cf663d95fd94fbdbdf2a88b165 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Mon, 18 Mar 2019 19:56:34 +0100 Subject: Add categories in rc/ Closes #2783 --- rc/base/lua.kak | 103 -------------------------------------------------------- 1 file changed, 103 deletions(-) delete mode 100644 rc/base/lua.kak (limited to 'rc/base/lua.kak') diff --git a/rc/base/lua.kak b/rc/base/lua.kak deleted file mode 100644 index 605148e0..00000000 --- a/rc/base/lua.kak +++ /dev/null @@ -1,103 +0,0 @@ -# http://lua.org -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -# Detection -# ‾‾‾‾‾‾‾‾‾ - -hook global BufCreate .*[.](lua) %{ - set-option buffer filetype lua -} - -# Highlighters -# ‾‾‾‾‾‾‾‾‾‾‾‾ - -add-highlighter shared/lua regions -add-highlighter shared/lua/code default-region group -add-highlighter shared/lua/raw_string region -match-capture '\[(=*)\[' '\](=*)\]' fill string -add-highlighter shared/lua/raw_comment region -match-capture '--\[(=*)\[' '\](=*)\]' fill comment -add-highlighter shared/lua/double_string region '"' (?^\h*(else)$^\h*(if)s\A|\z) } - try %{ execute-keys -draft ^\h*(end)$^\h*(for|function|if|while)s\A|\z) } - } -} - -define-command -hidden lua-indent-on-new-line %{ - evaluate-commands -no-hooks -draft -itersel %{ - # preserve previous line indent - try %{ execute-keys -draft K } - # remove trailing white spaces from previous line - try %{ execute-keys -draft ks\h+$d } - # indent after start structure - try %{ execute-keys -draft k^\h*(else|elseif|for|function|if|while)\bj } - } -} - -define-command -hidden lua-insert-on-new-line %[ - evaluate-commands -no-hooks -draft -itersel %[ - # copy -- comment prefix and following white spaces - try %{ execute-keys -draft ks^\h*\K--\h*yghjP } - # wisely add end structure - evaluate-commands -save-regs x %[ - try %{ execute-keys -draft ks^\h+"xy } catch %{ reg x '' } # Save previous line indent in register x - try %[ execute-keys -draft k ^x(for|function|if|while) J}iJ ^x(else|end|elseif)$ # Validate previous line and that it is not closed yet - execute-keys -draft oxend ] # auto insert end - ] - ] -] - -# Initialization -# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ - -hook -group lua-highlight global WinSetOption filetype=lua %{ - add-highlighter window/lua ref lua - hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lua } -} - -hook global WinSetOption filetype=lua %{ - hook window InsertChar .* -group lua-indent lua-indent-on-char - hook window InsertChar \n -group lua-indent lua-indent-on-new-line - hook window InsertChar \n -group lua-insert lua-insert-on-new-line - - alias window alt lua-alternative-file - - hook -once -always window WinSetOption filetype=.* %{ - remove-hooks window lua-.+ - unalias window alt lua-alternative-file - } -} -- cgit v1.2.3