2014-07-21 02:53:21 +04:00
|
|
|
# http://common-lisp.net
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
# Detection
|
|
|
|
# ‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
hook global BufCreate .*[.](lisp) %{
|
|
|
|
set buffer filetype lisp
|
|
|
|
}
|
|
|
|
|
|
|
|
# Highlighters
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
addhl -group / regions -default code lisp \
|
|
|
|
string '"' (?<!\\)(\\\\)*" '' \
|
|
|
|
comment ';' '$' ''
|
|
|
|
|
|
|
|
addhl -group /lisp/string fill string
|
|
|
|
addhl -group /lisp/comment fill comment
|
|
|
|
|
2016-04-21 22:43:17 +03:00
|
|
|
addhl -group /lisp/code regex \b(nil|true|false)\b 0:value
|
2014-07-21 02:53:21 +04:00
|
|
|
addhl -group /lisp/code regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=|) 0:operator
|
2016-04-21 22:43:17 +03:00
|
|
|
addhl -group /lisp/code regex \b(([':]\w+)|([*]\H+[*]))\b 0:identifier
|
|
|
|
addhl -group /lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword
|
2014-07-21 02:53:21 +04:00
|
|
|
|
|
|
|
# Commands
|
|
|
|
# ‾‾‾‾‾‾‾‾
|
|
|
|
|
|
|
|
def -hidden _lisp_filter_around_selections %{
|
2015-11-04 12:48:47 +03:00
|
|
|
# remove trailing white spaces
|
|
|
|
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
|
2014-07-21 02:53:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
def -hidden _lisp_indent_on_new_line %{
|
|
|
|
eval -draft -itersel %{
|
|
|
|
# preserve previous line indent
|
|
|
|
try %{ exec -draft <space> K <a-&> }
|
|
|
|
# indent when matches opening paren
|
|
|
|
try %{ exec -draft [( <a-k> \`\([^\n]+\n[^\n]*\n?\' <ret> <a-\;> \; <a-gt> }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Initialization
|
|
|
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
|
|
|
2016-09-25 16:15:07 +03:00
|
|
|
hook -group lisp-highlight global WinSetOption filetype=lisp %{ addhl ref lisp }
|
2014-07-21 02:53:21 +04:00
|
|
|
|
2016-09-25 16:15:07 +03:00
|
|
|
hook global WinSetOption filetype=lisp %{
|
2014-07-21 02:53:21 +04:00
|
|
|
hook window InsertEnd .* -group lisp-hooks _lisp_filter_around_selections
|
|
|
|
hook window InsertChar \n -group lisp-indent _lisp_indent_on_new_line
|
|
|
|
}
|
|
|
|
|
2016-10-01 16:09:59 +03:00
|
|
|
hook -group lisp-highlight global WinSetOption filetype=(?!lisp).* %{ rmhl lisp }
|
2016-09-28 09:45:01 +03:00
|
|
|
|
2014-07-21 02:53:21 +04:00
|
|
|
hook global WinSetOption filetype=(?!lisp).* %{
|
|
|
|
rmhooks window lisp-indent
|
|
|
|
rmhooks window lisp-hooks
|
|
|
|
}
|