Fix naming conventions in bundled scripts

Do not use _ prefix for hidden commands, use - as a word separator
in command names.
This commit is contained in:
Maxime Coste 2017-01-13 00:56:30 +00:00
parent 91a56c11fe
commit 5ad4499503
36 changed files with 196 additions and 196 deletions

View File

@ -22,16 +22,16 @@ add-highlighter -group /clojure regex \b(clojure.core/['/\w]+)\b 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _clojure_filter_around_selections _lisp_filter_around_selections def -hidden clojure-filter-around-selections lisp-filter-around-selections
def -hidden _clojure_indent_on_new_line _lisp_indent_on_new_line def -hidden clojure-indent-on-new-line lisp-indent-on-new-line
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter ref clojure } hook -group clojure-highlight global WinSetOption filetype=clojure %{ add-highlighter ref clojure }
hook global WinSetOption filetype=clojure %[ hook global WinSetOption filetype=clojure %[
hook window InsertEnd .* -group clojure-hooks _clojure_filter_around_selections hook window InsertEnd .* -group clojure-hooks clojure-filter-around-selections
hook window InsertChar \n -group clojure-indent _clojure_indent_on_new_line hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line
] ]
hook -group clojure-highlight global WinSetOption filetype=(?!clojure).* %{ remove-highlighter clojure } hook -group clojure-highlight global WinSetOption filetype=(?!clojure).* %{ remove-highlighter clojure }

View File

@ -36,23 +36,23 @@ add-highlighter -group /css/selector regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:iden
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _css_filter_around_selections %{ def -hidden css-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _css_indent_on_new_line %[ def -hidden css-indent-on-new-line %[
eval -draft -itersel %[ eval -draft -itersel %[
# preserve previous line indent # preserve previous line indent
try %[ exec -draft \; K <a-&> ] try %[ exec -draft \; K <a-&> ]
# filter previous line # filter previous line
try %[ exec -draft k : _css_filter_around_selections <ret> ] try %[ exec -draft k : css-filter-around-selections <ret> ]
# indent after lines ending with with { # indent after lines ending with with {
try %[ exec -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ] try %[ exec -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ]
] ]
] ]
def -hidden _css_indent_on_closing_curly_brace %[ def -hidden css-indent-on-closing-curly-brace %[
eval -draft -itersel %[ eval -draft -itersel %[
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \`|.\' <ret> 1<a-&> ] try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \`|.\' <ret> 1<a-&> ]
@ -65,9 +65,9 @@ def -hidden _css_indent_on_closing_curly_brace %[
hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter ref css } hook -group css-highlight global WinSetOption filetype=css %{ add-highlighter ref css }
hook global WinSetOption filetype=css %[ hook global WinSetOption filetype=css %[
hook window InsertEnd .* -group css-hooks _css_filter_around_selections hook window InsertEnd .* -group css-hooks css-filter-around-selections
hook window InsertChar \n -group css-indent _css_indent_on_new_line hook window InsertChar \n -group css-indent css-indent-on-new-line
hook window InsertChar \} -group css-indent _css_indent_on_closing_curly_brace hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace
] ]
hook -group css-highlight global WinSetOption filetype=(?!css).* %{ remove-highlighter css } hook -group css-highlight global WinSetOption filetype=(?!css).* %{ remove-highlighter css }

View File

@ -81,7 +81,7 @@ add-highlighter -group /d/code regex "\b(this)\b\s*[^(]" 1:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _d-indent-on-new-line %~ def -hidden d-indent-on-new-line %~
eval -draft -itersel %= eval -draft -itersel %=
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \;K<a-&> } try %{ exec -draft \;K<a-&> }
@ -100,12 +100,12 @@ def -hidden _d-indent-on-new-line %~
= =
~ ~
def -hidden _d-indent-on-opening-curly-brace %[ def -hidden d-indent-on-opening-curly-brace %[
# align indent with opening paren when { is entered on a new line after the closing paren # align indent with opening paren when { is entered on a new line after the closing paren
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ] try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
] ]
def -hidden _d-indent-on-closing-curly-brace %[ def -hidden d-indent-on-closing-curly-brace %[
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ] try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
] ]
@ -118,9 +118,9 @@ hook -group d-highlight global WinSetOption filetype=d %{ add-highlighter ref d
hook global WinSetOption filetype=d %{ hook global WinSetOption filetype=d %{
# cleanup trailing whitespaces when exiting insert mode # cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group d-hooks %{ try %{ exec -draft <a-x>s^\h+$<ret>d } } hook window InsertEnd .* -group d-hooks %{ try %{ exec -draft <a-x>s^\h+$<ret>d } }
hook window InsertChar \n -group d-indent _d-indent-on-new-line hook window InsertChar \n -group d-indent d-indent-on-new-line
hook window InsertChar \{ -group d-indent _d-indent-on-opening-curly-brace hook window InsertChar \{ -group d-indent d-indent-on-opening-curly-brace
hook window InsertChar \} -group d-indent _d-indent-on-closing-curly-brace hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace
} }
hook -group d-highlight global WinSetOption filetype=(?!d).* %{ remove-highlighter d } hook -group d-highlight global WinSetOption filetype=(?!d).* %{ remove-highlighter d }

View File

@ -29,14 +29,14 @@ add-highlighter -group /fish/code regex \b(and|begin|bg|bind|block|break|breakpo
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _fish_filter_around_selections %{ def -hidden fish-filter-around-selections %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft <a-x>s\h+$<ret>d } try %{ exec -draft <a-x>s\h+$<ret>d }
} }
} }
def -hidden _fish_indent_on_char %{ def -hidden fish-indent-on-char %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# align middle and end structures to start and indent when necessary # align middle and end structures to start and indent when necessary
try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\Z<ret>'<a-&> } try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\Z<ret>'<a-&> }
@ -45,18 +45,18 @@ def -hidden _fish_indent_on_char %{
} }
} }
def -hidden _fish_indent_on_new_line %{ def -hidden fish-indent-on-new-line %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft <space>K<a-&> } try %{ exec -draft <space>K<a-&> }
# filter previous line # filter previous line
try %{ exec -draft k:_fish_filter_around_selections<ret> } try %{ exec -draft k:fish-filter-around-selections<ret> }
# indent after start structure # indent after start structure
try %{ exec -draft k<a-x><a-k>^\h*(begin|case|else|for|function|if|switch|while)\b<ret>j<a-gt> } try %{ exec -draft k<a-x><a-k>^\h*(begin|case|else|for|function|if|switch|while)\b<ret>j<a-gt> }
} }
} }
def -hidden _fish_insert_on_new_line %{ def -hidden fish-insert-on-new-line %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# copy _#_ comment prefix and following white spaces # copy _#_ comment prefix and following white spaces
try %{ exec -draft k<a-x>s^\h*\K#\h*<ret>yjp } try %{ exec -draft k<a-x>s^\h*\K#\h*<ret>yjp }
@ -74,9 +74,9 @@ def -hidden _fish_insert_on_new_line %{
hook -group fish-highlight global WinSetOption filetype=fish %{ add-highlighter ref fish } hook -group fish-highlight global WinSetOption filetype=fish %{ add-highlighter ref fish }
hook global WinSetOption filetype=fish %{ hook global WinSetOption filetype=fish %{
hook window InsertChar .* -group fish-indent _fish_indent_on_char hook window InsertChar .* -group fish-indent fish-indent-on-char
hook window InsertChar \n -group fish-insert _fish_insert_on_new_line hook window InsertChar \n -group fish-insert fish-insert-on-new-line
hook window InsertChar \n -group fish-indent _fish_indent_on_new_line hook window InsertChar \n -group fish-indent fish-indent-on-new-line
} }
hook -group fish-highlight global WinSetOption filetype=(?!fish).* %{ remove-highlighter fish } hook -group fish-highlight global WinSetOption filetype=(?!fish).* %{ remove-highlighter fish }

View File

@ -66,7 +66,7 @@ add-highlighter -group /gas/code regex \
^\h*(cvttp[ds]2dq|cvttp[ds]2pi|cvtts[ds]2si)\b|\ ^\h*(cvttp[ds]2dq|cvttp[ds]2pi|cvtts[ds]2si)\b|\
^\h*(vxorp[sd]|vandp[sd]|ucomis[sd])\b 0:keyword ^\h*(vxorp[sd]|vandp[sd]|ucomis[sd])\b 0:keyword
def -hidden _gas_filter_around_selections %{ def -hidden gas-filter-around-selections %{
eval -draft -itersel %{ eval -draft -itersel %{
exec <a-x> exec <a-x>
# remove trailing white spaces # remove trailing white spaces
@ -74,12 +74,12 @@ def -hidden _gas_filter_around_selections %{
} }
} }
def -hidden _gas_indent_on_new_line %~ def -hidden gas-indent-on-new-line %~
eval -draft -itersel %< eval -draft -itersel %<
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _gas_filter_around_selections <ret> } try %{ exec -draft k : gas-filter-around-selections <ret> }
# indent after label # indent after label
try %[ exec -draft k <a-x> <a-k> :$ <ret> j <a-gt> ] try %[ exec -draft k <a-x> <a-k> :$ <ret> j <a-gt> ]
> >
@ -88,7 +88,7 @@ def -hidden _gas_indent_on_new_line %~
hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter ref gas } hook -group gas-highlight global WinSetOption filetype=gas %{ add-highlighter ref gas }
hook global WinSetOption filetype=gas %{ hook global WinSetOption filetype=gas %{
hook window InsertChar \n -group gas-indent _gas_indent_on_new_line hook window InsertChar \n -group gas-indent gas-indent-on-new-line
} }
hook -group gas-highlight global WinSetOption filetype=(?!gas).* %{ remove-highlighter gas } hook -group gas-highlight global WinSetOption filetype=(?!gas).* %{ remove-highlighter gas }

View File

@ -53,7 +53,7 @@ add-highlighter -group /go/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _go-indent-on-new-line %~ def -hidden go-indent-on-new-line %~
eval -draft -itersel %= eval -draft -itersel %=
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \;K<a-&> } try %{ exec -draft \;K<a-&> }
@ -72,12 +72,12 @@ def -hidden _go-indent-on-new-line %~
= =
~ ~
def -hidden _go-indent-on-opening-curly-brace %[ def -hidden go-indent-on-opening-curly-brace %[
# align indent with opening paren when { is entered on a new line after the closing paren # align indent with opening paren when { is entered on a new line after the closing paren
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ] try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
] ]
def -hidden _go-indent-on-closing-curly-brace %[ def -hidden go-indent-on-closing-curly-brace %[
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ] try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
] ]
@ -90,9 +90,9 @@ hook -group go-highlight global WinSetOption filetype=go %{ add-highlighter ref
hook global WinSetOption filetype=go %{ hook global WinSetOption filetype=go %{
# cleanup trailing whitespaces when exiting insert mode # cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group go-hooks %{ try %{ exec -draft <a-x>s^\h+$<ret>d } } hook window InsertEnd .* -group go-hooks %{ try %{ exec -draft <a-x>s^\h+$<ret>d } }
hook window InsertChar \n -group go-indent _go-indent-on-new-line hook window InsertChar \n -group go-indent go-indent-on-new-line
hook window InsertChar \{ -group go-indent _go-indent-on-opening-curly-brace hook window InsertChar \{ -group go-indent go-indent-on-opening-curly-brace
hook window InsertChar \} -group go-indent _go-indent-on-closing-curly-brace hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace
} }
hook -group go-highlight global WinSetOption filetype=(?!go).* %{ remove-highlighter go } hook -group go-highlight global WinSetOption filetype=(?!go).* %{ remove-highlighter go }

View File

@ -31,12 +31,12 @@ add-highlighter -group /haskell/code regex \b(Int|Integer|Char|Bool|Float|Double
# http://en.wikibooks.org/wiki/Haskell/Indentation # http://en.wikibooks.org/wiki/Haskell/Indentation
def -hidden _haskell_filter_around_selections %{ def -hidden haskell-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _haskell_indent_on_new_line %{ def -hidden haskell-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy -- comments prefix and following white spaces # copy -- comments prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P }
@ -45,7 +45,7 @@ def -hidden _haskell_indent_on_new_line %{
# align to first clause # align to first clause
try %{ exec -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|do|let|where)\h+\K.* <ret> s \`|.\' <ret> & } try %{ exec -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|do|let|where)\h+\K.* <ret> s \`|.\' <ret> & }
# filter previous line # filter previous line
try %{ exec -draft k : _haskell_filter_around_selections <ret> } try %{ exec -draft k : haskell-filter-around-selections <ret> }
# indent after lines beginning with condition or ending with expression or =( # indent after lines beginning with condition or ending with expression or =(
try %{ exec -draft \; k x <a-k> ^\h*(if)|(case\h+[\w']+\h+of|do|let|where|[=(])$ <ret> j <a-gt> } try %{ exec -draft \; k x <a-k> ^\h*(if)|(case\h+[\w']+\h+of|do|let|where|[=(])$ <ret> j <a-gt> }
} }
@ -57,8 +57,8 @@ def -hidden _haskell_indent_on_new_line %{
hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter ref haskell } hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter ref haskell }
hook global WinSetOption filetype=haskell %{ hook global WinSetOption filetype=haskell %{
hook window InsertEnd .* -group haskell-hooks _haskell_filter_around_selections hook window InsertEnd .* -group haskell-hooks haskell-filter-around-selections
hook window InsertChar \n -group haskell-indent _haskell_indent_on_new_line hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line
} }
hook -group haskell-highlight global WinSetOption filetype=(?!haskell).* %{ remove-highlighter haskell } hook -group haskell-highlight global WinSetOption filetype=(?!haskell).* %{ remove-highlighter haskell }

View File

@ -37,24 +37,24 @@ add-highlighter -group /html/tag/content/string fill string
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _html_filter_around_selections %{ def -hidden html-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _html_indent_on_char %{ def -hidden html-indent-on-char %{
eval -draft -itersel %{ eval -draft -itersel %{
# align closing tag to opening when alone on a line # align closing tag to opening when alone on a line
try %{ exec -draft <space> <a-h> s ^\h+</(\w+)>$ <ret> <a-\;> <a-?> <lt><c-r>1 <ret> s \`|.\' <ret> <a-r> 1<a-&> } try %{ exec -draft <space> <a-h> s ^\h+</(\w+)>$ <ret> <a-\;> <a-?> <lt><c-r>1 <ret> s \`|.\' <ret> <a-r> 1<a-&> }
} }
} }
def -hidden _html_indent_on_new_line %{ def -hidden html-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _html_filter_around_selections <ret> } try %{ exec -draft k : html-filter-around-selections <ret> }
# indent after lines ending with opening tag # indent after lines ending with opening tag
try %{ exec -draft k <a-x> <a-k> <[^/][^>]+>$ <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-k> <[^/][^>]+>$ <ret> j <a-gt> }
} }
@ -66,9 +66,9 @@ def -hidden _html_indent_on_new_line %{
hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter ref html } hook -group html-highlight global WinSetOption filetype=(?:html|xml) %{ add-highlighter ref html }
hook global WinSetOption filetype=(?:html|xml) %{ hook global WinSetOption filetype=(?:html|xml) %{
hook window InsertEnd .* -group html-hooks _html_filter_around_selections hook window InsertEnd .* -group html-hooks html-filter-around-selections
hook window InsertChar .* -group html-indent _html_indent_on_char hook window InsertChar .* -group html-indent html-indent-on-char
hook window InsertChar \n -group html-indent _html_indent_on_new_line hook window InsertChar \n -group html-indent html-indent-on-new-line
} }
hook -group html-highlight global WinSetOption filetype=(?!html|xml).* %{ remove-highlighter html } hook -group html-highlight global WinSetOption filetype=(?!html|xml).* %{ remove-highlighter html }

View File

@ -37,26 +37,26 @@ add-highlighter -group /javascript/code regex \b(break|case|catch|class|const|co
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _javascript_filter_around_selections %{ def -hidden javascript-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _javascript_indent_on_char %< def -hidden javascript-indent-on-char %<
eval -draft -itersel %< eval -draft -itersel %<
# align closer token to its opener when alone on a line # align closer token to its opener when alone on a line
try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> / try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> /
> >
> >
def -hidden _javascript_indent_on_new_line %< def -hidden javascript-indent-on-new-line %<
eval -draft -itersel %< eval -draft -itersel %<
# copy // comments prefix and following white spaces # copy // comments prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _javascript_filter_around_selections <ret> } try %{ exec -draft k : javascript-filter-around-selections <ret> }
# indent after lines beginning / ending with opener token # indent after lines beginning / ending with opener token
try %_ exec -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _ try %_ exec -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
> >
@ -68,9 +68,9 @@ def -hidden _javascript_indent_on_new_line %<
hook -group javascript-highlight global WinSetOption filetype=javascript %{ add-highlighter ref javascript } hook -group javascript-highlight global WinSetOption filetype=javascript %{ add-highlighter ref javascript }
hook global WinSetOption filetype=javascript %{ hook global WinSetOption filetype=javascript %{
hook window InsertEnd .* -group javascript-hooks _javascript_filter_around_selections hook window InsertEnd .* -group javascript-hooks javascript-filter-around-selections
hook window InsertChar .* -group javascript-indent _javascript_indent_on_char hook window InsertChar .* -group javascript-indent javascript-indent-on-char
hook window InsertChar \n -group javascript-indent _javascript_indent_on_new_line hook window InsertChar \n -group javascript-indent javascript-indent-on-new-line
} }
hook -group javascript-highlight global WinSetOption filetype=(?!javascript).* %{ remove-highlighter javascript } hook -group javascript-highlight global WinSetOption filetype=(?!javascript).* %{ remove-highlighter javascript }

View File

@ -21,24 +21,24 @@ add-highlighter -group /json/code regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _json_filter_around_selections %{ def -hidden json-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _json_indent_on_char %< def -hidden json-indent-on-char %<
eval -draft -itersel %< eval -draft -itersel %<
# align closer token to its opener when alone on a line # align closer token to its opener when alone on a line
try %< exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> > try %< exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> >
> >
> >
def -hidden _json_indent_on_new_line %< def -hidden json-indent-on-new-line %<
eval -draft -itersel %< eval -draft -itersel %<
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _json_filter_around_selections <ret> } try %{ exec -draft k : json-filter-around-selections <ret> }
# indent after lines beginning with opener token # indent after lines beginning with opener token
try %< exec -draft k <a-x> <a-k> ^\h*[[{] <ret> j <a-gt> > try %< exec -draft k <a-x> <a-k> ^\h*[[{] <ret> j <a-gt> >
> >
@ -50,9 +50,9 @@ def -hidden _json_indent_on_new_line %<
hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter ref json } hook -group json-highlight global WinSetOption filetype=json %{ add-highlighter ref json }
hook global WinSetOption filetype=json %{ hook global WinSetOption filetype=json %{
hook window InsertEnd .* -group json-hooks _json_filter_around_selections hook window InsertEnd .* -group json-hooks json-filter-around-selections
hook window InsertChar .* -group json-indent _json_indent_on_char hook window InsertChar .* -group json-indent json-indent-on-char
hook window InsertChar \n -group json-indent _json_indent_on_new_line hook window InsertChar \n -group json-indent json-indent-on-new-line
} }
hook -group json-highlight global WinSetOption filetype=(?!json).* %{ remove-highlighter json } hook -group json-highlight global WinSetOption filetype=(?!json).* %{ remove-highlighter json }

View File

@ -26,12 +26,12 @@ add-highlighter -group /lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _lisp_filter_around_selections %{ def -hidden lisp-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _lisp_indent_on_new_line %{ def -hidden lisp-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
@ -46,8 +46,8 @@ def -hidden _lisp_indent_on_new_line %{
hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter ref lisp } hook -group lisp-highlight global WinSetOption filetype=lisp %{ add-highlighter ref lisp }
hook global WinSetOption filetype=lisp %{ hook global WinSetOption filetype=lisp %{
hook window InsertEnd .* -group lisp-hooks _lisp_filter_around_selections hook window InsertEnd .* -group lisp-hooks lisp-filter-around-selections
hook window InsertChar \n -group lisp-indent _lisp_indent_on_new_line hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line
} }
hook -group lisp-highlight global WinSetOption filetype=(?!lisp).* %{ remove-highlighter lisp } hook -group lisp-highlight global WinSetOption filetype=(?!lisp).* %{ remove-highlighter lisp }

View File

@ -51,14 +51,14 @@ def lua-alternative-file -docstring 'Jump to the alternate file (implementation
printf %s\\n "edit $altfile" printf %s\\n "edit $altfile"
}} }}
def -hidden _lua_filter_around_selections %{ def -hidden lua-filter-around-selections %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft <a-x>s\h+$<ret>d } try %{ exec -draft <a-x>s\h+$<ret>d }
} }
} }
def -hidden _lua_indent_on_char %{ def -hidden lua-indent-on-char %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# align middle and end structures to start and indent when necessary, elseif is already covered by else # align middle and end structures to start and indent when necessary, elseif is already covered by else
try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\Z<ret>'<a-&> } try %{ exec -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\Z<ret>'<a-&> }
@ -66,18 +66,18 @@ def -hidden _lua_indent_on_char %{
} }
} }
def -hidden _lua_indent_on_new_line %{ def -hidden lua-indent-on-new-line %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft <space>K<a-&> } try %{ exec -draft <space>K<a-&> }
# filter previous line # filter previous line
try %{ exec -draft k:_lua_filter_around_selections<ret> } try %{ exec -draft k:lua-filter-around-selections<ret> }
# indent after start structure # indent after start structure
try %{ exec -draft k<a-x><a-k>^\h*(else|elseif|for|function|if|while)\b<ret>j<a-gt> } try %{ exec -draft k<a-x><a-k>^\h*(else|elseif|for|function|if|while)\b<ret>j<a-gt> }
} }
} }
def -hidden _lua_insert_on_new_line %{ def -hidden lua-insert-on-new-line %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# copy -- comment prefix and following white spaces # copy -- comment prefix and following white spaces
try %{ exec -draft k<a-x>s^\h*\K--\h*<ret>yjp } try %{ exec -draft k<a-x>s^\h*\K--\h*<ret>yjp }
@ -95,9 +95,9 @@ def -hidden _lua_insert_on_new_line %{
hook -group lua-highlight global WinSetOption filetype=lua %{ add-highlighter ref lua } hook -group lua-highlight global WinSetOption filetype=lua %{ add-highlighter ref lua }
hook global WinSetOption filetype=lua %{ hook global WinSetOption filetype=lua %{
hook window InsertChar .* -group lua-indent _lua_indent_on_char hook window InsertChar .* -group lua-indent lua-indent-on-char
hook window InsertChar \n -group lua-insert _lua_insert_on_new_line hook window InsertChar \n -group lua-insert lua-insert-on-new-line
hook window InsertChar \n -group lua-indent _lua_indent_on_new_line hook window InsertChar \n -group lua-indent lua-indent-on-new-line
alias window alt lua-alternative-file alias window alt lua-alternative-file
} }

View File

@ -124,7 +124,7 @@ add-highlighter -group /markdown/content regex \H\K\h\h$ 0:PrimarySelection
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _markdown_indent_on_new_line %{ def -hidden markdown-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy block quote(s), list item prefix and following white spaces # copy block quote(s), list item prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K((>\h*)|[*+-])+\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K((>\h*)|[*+-])+\h* <ret> y gh j P }
@ -141,7 +141,7 @@ def -hidden _markdown_indent_on_new_line %{
hook -group markdown-highlight global WinSetOption filetype=markdown %{ add-highlighter ref markdown } hook -group markdown-highlight global WinSetOption filetype=markdown %{ add-highlighter ref markdown }
hook global WinSetOption filetype=markdown %{ 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 -group markdown-highlight global WinSetOption filetype=(?!markdown).* %{ remove-highlighter markdown } hook -group markdown-highlight global WinSetOption filetype=(?!markdown).* %{ remove-highlighter markdown }

View File

@ -73,7 +73,7 @@ add-highlighter -group /perl/code regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATO
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _perl-indent-on-new-line %~ def -hidden perl-indent-on-new-line %~
eval -draft -itersel %= eval -draft -itersel %=
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \;K<a-&> } try %{ exec -draft \;K<a-&> }
@ -92,12 +92,12 @@ def -hidden _perl-indent-on-new-line %~
= =
~ ~
def -hidden _perl-indent-on-opening-curly-brace %[ def -hidden perl-indent-on-opening-curly-brace %[
# align indent with opening paren when { is entered on a new line after the closing paren # align indent with opening paren when { is entered on a new line after the closing paren
try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ] try %[ exec -draft -itersel h<a-F>)M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
] ]
def -hidden _perl-indent-on-closing-curly-brace %[ def -hidden perl-indent-on-closing-curly-brace %[
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ] try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
] ]
@ -110,9 +110,9 @@ hook -group perl-highlight global WinSetOption filetype=perl %{ add-highlighter
hook global WinSetOption filetype=perl %{ hook global WinSetOption filetype=perl %{
# cleanup trailing whitespaces when exiting insert mode # cleanup trailing whitespaces when exiting insert mode
hook window InsertEnd .* -group perl-hooks %{ try %{ exec -draft <a-x>s^\h+$<ret>d } } hook window InsertEnd .* -group perl-hooks %{ try %{ exec -draft <a-x>s^\h+$<ret>d } }
hook window InsertChar \n -group perl-indent _perl-indent-on-new-line hook window InsertChar \n -group perl-indent perl-indent-on-new-line
hook window InsertChar \{ -group perl-indent _perl-indent-on-opening-curly-brace hook window InsertChar \{ -group perl-indent perl-indent-on-opening-curly-brace
hook window InsertChar \} -group perl-indent _perl-indent-on-closing-curly-brace hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace
} }
hook -group perl-highlight global WinSetOption filetype=(?!perl).* %{ remove-highlighter perl } hook -group perl-highlight global WinSetOption filetype=(?!perl).* %{ remove-highlighter perl }

View File

@ -100,7 +100,7 @@ def ruby-alternative-file -docstring 'Jump to the alternate file (implementation
echo "edit $altfile" echo "edit $altfile"
}} }}
def -hidden _ruby_filter_around_selections %{ def -hidden ruby-filter-around-selections %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
exec <a-x> exec <a-x>
# remove trailing white spaces # remove trailing white spaces
@ -108,7 +108,7 @@ def -hidden _ruby_filter_around_selections %{
} }
} }
def -hidden _ruby_indent_on_char %{ def -hidden ruby-indent-on-char %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# align middle and end structures to start # align middle and end structures to start
try %{ exec -draft <a-x> <a-k> ^ \h * (else|elsif) $ <ret> <a-\;> <a-?> ^ \h * (if) <ret> s \A | \Z <ret> \' <a-&> } try %{ exec -draft <a-x> <a-k> ^ \h * (else|elsif) $ <ret> <a-\;> <a-?> ^ \h * (if) <ret> s \A | \Z <ret> \' <a-&> }
@ -118,18 +118,18 @@ def -hidden _ruby_indent_on_char %{
} }
} }
def -hidden _ruby_indent_on_new_line %{ def -hidden ruby-indent-on-new-line %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft K <a-&> } try %{ exec -draft K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _ruby_filter_around_selections <ret> } try %{ exec -draft k : ruby-filter-around-selections <ret> }
# indent after start structure # indent after start structure
try %{ exec -draft k <a-x> <a-k> ^ \h * (begin|case|class|def|do|else|elsif|ensure|for|if|module|rescue|unless|until|when|while) \b <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-k> ^ \h * (begin|case|class|def|do|else|elsif|ensure|for|if|module|rescue|unless|until|when|while) \b <ret> j <a-gt> }
} }
} }
def -hidden _ruby_insert_on_new_line %{ def -hidden ruby-insert-on-new-line %{
eval -no-hooks -draft -itersel %{ eval -no-hooks -draft -itersel %{
# copy _#_ comment prefix and following white spaces # copy _#_ comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P } try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P }
@ -147,9 +147,9 @@ def -hidden _ruby_insert_on_new_line %{
hook -group ruby-highlight global WinSetOption filetype=ruby %{ add-highlighter ref ruby } hook -group ruby-highlight global WinSetOption filetype=ruby %{ add-highlighter ref ruby }
hook global WinSetOption filetype=ruby %{ hook global WinSetOption filetype=ruby %{
hook window InsertChar .* -group ruby-indent _ruby_indent_on_char hook window InsertChar .* -group ruby-indent ruby-indent-on-char
hook window InsertChar \n -group ruby-insert _ruby_insert_on_new_line hook window InsertChar \n -group ruby-insert ruby-insert-on-new-line
hook window InsertChar \n -group ruby-indent _ruby_indent_on_new_line hook window InsertChar \n -group ruby-indent ruby-indent-on-new-line
alias window alt ruby-alternative-file alias window alt ruby-alternative-file
} }

View File

@ -34,19 +34,19 @@ add-highlighter -group /rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _rust_filter_around_selections %{ def -hidden rust-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _rust_indent_on_new_line %~ def -hidden rust-indent-on-new-line %~
eval -draft -itersel %< eval -draft -itersel %<
# copy // comments prefix and following white spaces # copy // comments prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K//\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K//\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _rust_filter_around_selections <ret> } try %{ exec -draft k : rust-filter-around-selections <ret> }
# indent after lines ending with { or ( # indent after lines ending with { or (
try %[ exec -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ] try %[ exec -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
# align to opening paren of previous line # align to opening paren of previous line
@ -54,14 +54,14 @@ def -hidden _rust_indent_on_new_line %~
> >
~ ~
def -hidden _rust_indent_on_opening_curly_brace %[ def -hidden rust-indent-on-opening-curly-brace %[
eval -draft -itersel %_ eval -draft -itersel %_
# align indent with opening paren when { is entered on a new line after the closing paren # align indent with opening paren when { is entered on a new line after the closing paren
try %[ exec -draft h <a-F> ) M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ] try %[ exec -draft h <a-F> ) M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
_ _
] ]
def -hidden _rust_indent_on_closing_curly_brace %[ def -hidden rust-indent-on-closing-curly-brace %[
eval -draft -itersel %_ eval -draft -itersel %_
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \`|.\' <ret> 1<a-&> ] try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \`|.\' <ret> 1<a-&> ]
@ -74,10 +74,10 @@ def -hidden _rust_indent_on_closing_curly_brace %[
hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter ref rust } hook -group rust-highlight global WinSetOption filetype=rust %{ add-highlighter ref rust }
hook global WinSetOption filetype=rust %[ hook global WinSetOption filetype=rust %[
hook window InsertEnd .* -group rust-hooks _rust_filter_around_selections hook window InsertEnd .* -group rust-hooks rust-filter-around-selections
hook window InsertChar \n -group rust-indent _rust_indent_on_new_line hook window InsertChar \n -group rust-indent rust-indent-on-new-line
hook window InsertChar \{ -group rust-indent _rust_indent_on_opening_curly_brace hook window InsertChar \{ -group rust-indent rust-indent-on-opening-curly-brace
hook window InsertChar \} -group rust-indent _rust_indent_on_closing_curly_brace hook window InsertChar \} -group rust-indent rust-indent-on-closing-curly-brace
] ]
hook -group rust-highlight global WinSetOption filetype=(?!rust).* %{ remove-highlighter rust } hook -group rust-highlight global WinSetOption filetype=(?!rust).* %{ remove-highlighter rust }

View File

@ -34,25 +34,25 @@ add-highlighter -group /scala/code regex "'[_A-Za-z0-9$]+" 0:identifier
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _scala_filter_around_selections %{ def -hidden scala-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _scala_indent_on_new_line %[ def -hidden scala-indent-on-new-line %[
eval -draft -itersel %[ eval -draft -itersel %[
# copy // comments prefix and following white spaces # copy // comments prefix and following white spaces
try %[ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ] try %[ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ]
# preserve previous line indent # preserve previous line indent
try %[ exec -draft \; K <a-&> ] try %[ exec -draft \; K <a-&> ]
# filter previous line # filter previous line
try %[ exec -draft k : _scala_filter_around_selections <ret> ] try %[ exec -draft k : scala-filter-around-selections <ret> ]
# indent after lines ending with { # indent after lines ending with {
try %[ exec -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ] try %[ exec -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ]
] ]
] ]
def -hidden _scala_indent_on_closing_curly_brace %[ def -hidden scala-indent-on-closing-curly-brace %[
eval -draft -itersel %[ eval -draft -itersel %[
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \`|.\' <ret> 1<a-&> ] try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> m s \`|.\' <ret> 1<a-&> ]
@ -65,9 +65,9 @@ def -hidden _scala_indent_on_closing_curly_brace %[
hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter ref scala } hook -group scala-highlight global WinSetOption filetype=scala %{ add-highlighter ref scala }
hook global WinSetOption filetype=scala %[ hook global WinSetOption filetype=scala %[
hook window InsertEnd .* -group scala-hooks _scala_filter_around_selections hook window InsertEnd .* -group scala-hooks scala-filter-around-selections
hook window InsertChar \n -group scala-indent _scala_indent_on_new_line hook window InsertChar \n -group scala-indent scala-indent-on-new-line
hook window InsertChar \} -group scala-indent _scala_indent_on_closing_curly_brace hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace
] ]
hook -group scala-highlight global WinSetOption filetype=(?!scala).* %{ remove-highlighter scala } hook -group scala-highlight global WinSetOption filetype=(?!scala).* %{ remove-highlighter scala }

View File

@ -27,19 +27,19 @@ add-highlighter -group /yaml/code regex \b(true|false|null)\b 0:value
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _yaml_filter_around_selections %{ def -hidden yaml-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _yaml_indent_on_new_line %{ def -hidden yaml-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy '#' comment prefix and following white spaces # copy '#' comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _yaml_filter_around_selections <ret> } try %{ exec -draft k : yaml-filter-around-selections <ret> }
# indent after : # indent after :
try %{ exec -draft <space> k x <a-k> :$ <ret> j <a-gt> } try %{ exec -draft <space> k x <a-k> :$ <ret> j <a-gt> }
} }
@ -51,8 +51,8 @@ def -hidden _yaml_indent_on_new_line %{
hook -group yaml-highlight global WinSetOption filetype=yaml %{ add-highlighter ref yaml } hook -group yaml-highlight global WinSetOption filetype=yaml %{ add-highlighter ref yaml }
hook global WinSetOption filetype=yaml %{ hook global WinSetOption filetype=yaml %{
hook window InsertEnd .* -group yaml-hooks _yaml_filter_around_selections hook window InsertEnd .* -group yaml-hooks yaml-filter-around-selections
hook window InsertChar \n -group yaml-indent _yaml_indent_on_new_line hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
} }
hook -group yaml-highlight global WinSetOption filetype=(?!yaml).* %{ remove-highlighter yaml } hook -group yaml-highlight global WinSetOption filetype=(?!yaml).* %{ remove-highlighter yaml }

View File

@ -1,6 +1,6 @@
decl str docsclient decl str docsclient
def -hidden -params 1..2 _doc-open %{ def -hidden -params 1..2 doc-open %{
%sh{ %sh{
manout=$(mktemp /tmp/kak-man-XXXXXX) manout=$(mktemp /tmp/kak-man-XXXXXX)
@ -46,7 +46,7 @@ An optional keyword argument can be passed to the function, which will be automa
exit exit
fi fi
printf %s\\n "eval -try-client %opt{docsclient} _doc-open ${PATH_DOC} $@" printf %s\\n "eval -try-client %opt{docsclient} doc-open ${PATH_DOC} $@"
} }
} }

View File

@ -34,7 +34,7 @@ add-highlighter -group /makefile/content regex [+?:]= 0:operator
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _makefile-indent-on-new-line %{ def -hidden makefile-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \;K<a-&> } try %{ exec -draft \;K<a-&> }
@ -53,7 +53,7 @@ def -hidden _makefile-indent-on-new-line %{
hook -group makefile-highlight global WinSetOption filetype=makefile %{ add-highlighter ref makefile } hook -group makefile-highlight global WinSetOption filetype=makefile %{ add-highlighter ref makefile }
hook global WinSetOption filetype=makefile %{ hook global WinSetOption filetype=makefile %{
hook window InsertChar \n -group makefile-indent _makefile-indent-on-new-line hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line
} }
hook -group makefile-highlight global WinSetOption filetype=(?!makefile).* %{ remove-highlighter makefile } hook -group makefile-highlight global WinSetOption filetype=(?!makefile).* %{ remove-highlighter makefile }

View File

@ -16,7 +16,7 @@ hook -group man-highlight global WinSetOption filetype=man %{
hook global WinSetOption filetype=man %{ hook global WinSetOption filetype=man %{
hook -group man-hooks window WinResize .* %{ hook -group man-hooks window WinResize .* %{
_man %opt{_manpage} man-impl %opt{_manpage}
} }
} }
@ -26,7 +26,7 @@ hook global WinSetOption filetype=(?!man).* %{
remove-hooks window man-hooks remove-hooks window man-hooks
} }
def -hidden -params 1..2 _man %{ %sh{ def -hidden -params 1..2 man-impl %{ %sh{
manout=$(mktemp /tmp/kak-man-XXXXXX) manout=$(mktemp /tmp/kak-man-XXXXXX)
colout=$(mktemp /tmp/kak-man-XXXXXX) colout=$(mktemp /tmp/kak-man-XXXXXX)
MANWIDTH=${kak_window_width} man "$@" > $manout MANWIDTH=${kak_window_width} man "$@" > $manout
@ -71,5 +71,5 @@ The page can be a word, or a word directly followed by a section number between
subject=${subject%%\(*} subject=${subject%%\(*}
fi fi
printf %s\\n "eval -collapse-jumps -try-client %opt{docsclient} _man $pagenum $subject" printf %s\\n "eval -collapse-jumps -try-client %opt{docsclient} man-impl $pagenum $subject"
} } } }

View File

@ -24,32 +24,32 @@ add-highlighter -group /cabal/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*: 1:iden
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _cabal_filter_around_selections %{ def -hidden cabal-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _cabal_indent_on_new_line %[ def -hidden cabal-indent-on-new-line %[
eval -draft -itersel %[ eval -draft -itersel %[
# copy '#' comment prefix and following white spaces # copy '#' comment prefix and following white spaces
try %[ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ] try %[ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ]
# preserve previous line indent # preserve previous line indent
try %[ exec -draft \; K <a-&> ] try %[ exec -draft \; K <a-&> ]
# filter previous line # filter previous line
try %[ exec -draft k : _cabal_filter_around_selections <ret> ] try %[ exec -draft k : cabal-filter-around-selections <ret> ]
# indent after lines ending with { or : # indent after lines ending with { or :
try %[ exec -draft <space> k <a-x> <a-k> [:{]$ <ret> j <a-gt> ] try %[ exec -draft <space> k <a-x> <a-k> [:{]$ <ret> j <a-gt> ]
] ]
] ]
def -hidden _cabal_indent_on_opening_curly_brace %[ def -hidden cabal-indent-on-opening-curly-brace %[
eval -draft -itersel %[ eval -draft -itersel %[
# align indent with opening paren when { is entered on a new line after the closing paren # align indent with opening paren when { is entered on a new line after the closing paren
try %[ exec -draft h <a-F> ) M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ] try %[ exec -draft h <a-F> ) M <a-k> \`\(.*\)\h*\n\h*\{\' <ret> s \`|.\' <ret> 1<a-&> ]
] ]
] ]
def -hidden _cabal_indent_on_closing_curly_brace %[ def -hidden cabal-indent-on-closing-curly-brace %[
eval -draft -itersel %[ eval -draft -itersel %[
# align to opening curly brace when alone on a line # align to opening curly brace when alone on a line
try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \`|.\'<ret> 1<a-&> ] try %[ exec -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \`|.\'<ret> 1<a-&> ]
@ -62,10 +62,10 @@ def -hidden _cabal_indent_on_closing_curly_brace %[
hook -group cabal-highlight global WinSetOption filetype=cabal %{ add-highlighter ref cabal } hook -group cabal-highlight global WinSetOption filetype=cabal %{ add-highlighter ref cabal }
hook global WinSetOption filetype=cabal %[ hook global WinSetOption filetype=cabal %[
hook window InsertEnd .* -group cabal-hooks _cabal_filter_around_selections hook window InsertEnd .* -group cabal-hooks cabal-filter-around-selections
hook window InsertChar \n -group cabal-indent _cabal_indent_on_new_line hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line
hook window InsertChar \{ -group cabal-indent _cabal_indent_on_opening_curly_brace hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace
hook window InsertChar \} -group cabal-indent _cabal_indent_on_closing_curly_brace hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace
] ]
hook -group cabal-highlight global WinSetOption filetype=(?!cabal).* %{ remove-highlighter cabal } hook -group cabal-highlight global WinSetOption filetype=(?!cabal).* %{ remove-highlighter cabal }

View File

@ -45,7 +45,7 @@ add-highlighter -group /coffee/code regex \b(break|case|catch|class|const|contin
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _coffee_filter_around_selections %{ def -hidden coffee-filter-around-selections %{
eval -draft -itersel %{ eval -draft -itersel %{
exec <a-x> exec <a-x>
# remove trailing white spaces # remove trailing white spaces
@ -53,14 +53,14 @@ def -hidden _coffee_filter_around_selections %{
} }
} }
def -hidden _coffee_indent_on_new_line %{ def -hidden coffee-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy '#' comment prefix and following white spaces # copy '#' comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P } try %{ exec -draft k <a-x> s ^ \h * \K \# \h * <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _coffee_filter_around_selections <ret> } try %{ exec -draft k : coffee-filter-around-selections <ret> }
# indent after start structure # indent after start structure
try %{ exec -draft k <a-x> <a-k> ^ \h * (case|catch|class|else|finally|for|function|if|switch|try|while|with) \b | (=|->) $ <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-k> ^ \h * (case|catch|class|else|finally|for|function|if|switch|try|while|with) \b | (=|->) $ <ret> j <a-gt> }
} }
@ -72,8 +72,8 @@ def -hidden _coffee_indent_on_new_line %{
hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter ref coffee } hook -group coffee-highlight global WinSetOption filetype=coffee %{ add-highlighter ref coffee }
hook global WinSetOption filetype=coffee %{ hook global WinSetOption filetype=coffee %{
hook window InsertEnd .* -group coffee-hooks _coffee_filter_around_selections hook window InsertEnd .* -group coffee-hooks coffee-filter-around-selections
hook window InsertChar \n -group coffee-indent _coffee_indent_on_new_line hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line
} }
hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ remove-highlighter coffee } hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ remove-highlighter coffee }

View File

@ -56,19 +56,19 @@ add-highlighter -group /cucumber/code regex \b(Feature|Business\h+Need|Ability|B
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _cucumber_filter_around_selections %{ def -hidden cucumber-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _cucumber_indent_on_new_line %{ def -hidden cucumber-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy '#' comment prefix and following white spaces # copy '#' comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _cucumber_filter_around_selections <ret> } try %{ exec -draft k : cucumber-filter-around-selections <ret> }
# indent after lines containing : # indent after lines containing :
try %{ exec -draft <space> k x <a-k> : <ret> j <a-gt> } try %{ exec -draft <space> k x <a-k> : <ret> j <a-gt> }
} }
@ -80,8 +80,8 @@ def -hidden _cucumber_indent_on_new_line %{
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter ref cucumber } hook -group cucumber-highlight global WinSetOption filetype=cucumber %{ add-highlighter ref cucumber }
hook global WinSetOption filetype=cucumber %{ hook global WinSetOption filetype=cucumber %{
hook window InsertEnd .* -group cucumber-hooks _cucumber_filter_around_selections hook window InsertEnd .* -group cucumber-hooks cucumber-filter-around-selections
hook window InsertChar \n -group cucumber-indent _cucumber_indent_on_new_line hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line
} }
hook -group cucumber-highlight global WinSetOption filetype=(?!cucumber).* %{ remove-highlighter cucumber } hook -group cucumber-highlight global WinSetOption filetype=(?!cucumber).* %{ remove-highlighter cucumber }

View File

@ -85,7 +85,7 @@ def -params ..1 go-format \
decl -hidden str go_doc_tmp_dir decl -hidden str go_doc_tmp_dir
# FIXME text escaping # FIXME text escaping
def -hidden -params 1..2 _gogetdoc-cmd %{ def -hidden -params 1..2 gogetdoc-cmd %{
%sh{ %sh{
dir=$(mktemp -d -t kak-go.XXXXXXXX) dir=$(mktemp -d -t kak-go.XXXXXXXX)
printf %s\\n "set buffer go_doc_tmp_dir ${dir}" printf %s\\n "set buffer go_doc_tmp_dir ${dir}"
@ -153,15 +153,15 @@ def -hidden -params 1..2 _gogetdoc-cmd %{
} }
def go-doc-info -docstring "Show the documention of the symbol under the cursor" %{ def go-doc-info -docstring "Show the documention of the symbol under the cursor" %{
_gogetdoc-cmd "info" gogetdoc-cmd "info"
} }
def go-print-signature -docstring "Print the signature of the symbol under the cursor" %{ def go-print-signature -docstring "Print the signature of the symbol under the cursor" %{
_gogetdoc-cmd "echo" gogetdoc-cmd "echo"
} }
def go-jump -docstring "Jump to the symbol definition" %{ def go-jump -docstring "Jump to the symbol definition" %{
_gogetdoc-cmd "jump" 1 gogetdoc-cmd "jump" 1
} }
def go-share-selection -docstring "Share the selection using the Go Playground" %{ %sh{ def go-share-selection -docstring "Share the selection using the Go Playground" %{ %sh{

View File

@ -33,19 +33,19 @@ add-highlighter -group /haml/code regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _haml_filter_around_selections %{ def -hidden haml-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _haml_indent_on_new_line %{ def -hidden haml-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy '/' comment prefix and following white spaces # copy '/' comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _haml_filter_around_selections <ret> } try %{ exec -draft k : haml-filter-around-selections <ret> }
# indent after lines beginning with : or - # indent after lines beginning with : or -
try %{ exec -draft k <a-x> <a-k> ^\h*[:-] <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-k> ^\h*[:-] <ret> j <a-gt> }
} }
@ -57,8 +57,8 @@ def -hidden _haml_indent_on_new_line %{
hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter ref haml } hook -group haml-highlight global WinSetOption filetype=haml %{ add-highlighter ref haml }
hook global WinSetOption filetype=haml %{ hook global WinSetOption filetype=haml %{
hook window InsertEnd .* -group haml-hooks _haml_filter_around_selections hook window InsertEnd .* -group haml-hooks haml-filter-around-selections
hook window InsertChar \n -group haml-indent _haml_indent_on_new_line hook window InsertChar \n -group haml-indent haml-indent-on-new-line
} }
hook -group haml-highlight global WinSetOption filetype=(?!haml).* %{ remove-highlighter haml } hook -group haml-highlight global WinSetOption filetype=(?!haml).* %{ remove-highlighter haml }

View File

@ -34,19 +34,19 @@ add-highlighter -group /hbs/block-expression regex ((\w|-)+)=(('|").*?('|")) 1:a
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _hbs_filter_around_selections %{ def -hidden hbs-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _hbs_indent_on_new_line %{ def -hidden hbs-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy '/' comment prefix and following white spaces # copy '/' comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y j p } try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y j p }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _hbs_filter_around_selections <ret> } try %{ exec -draft k : hbs-filter-around-selections <ret> }
# indent after lines beginning with : or - # indent after lines beginning with : or -
try %{ exec -draft k <a-x> <a-k> ^\h*[:-] <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-k> ^\h*[:-] <ret> j <a-gt> }
} }
@ -60,8 +60,8 @@ hook -group hbs-highlight global WinSetOption filetype=hbs %{
} }
hook global WinSetOption filetype=hbs %{ hook global WinSetOption filetype=hbs %{
hook window InsertEnd .* -group hbs-hooks _hbs_filter_around_selections hook window InsertEnd .* -group hbs-hooks hbs-filter-around-selections
hook window InsertChar \n -group hbs-indent _hbs_indent_on_new_line hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line
} }
hook -group hbs-highlight global WinSetOption filetype=(?!hbs).* %{ hook -group hbs-highlight global WinSetOption filetype=(?!hbs).* %{

View File

@ -11,7 +11,7 @@
# and the end of the buffer # and the end of the buffer
decl int modelines 5 decl int modelines 5
def -hidden _modeline-parse %{ def -hidden modeline-parse %{
%sh{ %sh{
# Translate a vim option into the corresponding kakoune one # Translate a vim option into the corresponding kakoune one
function translate_opt_vim { function translate_opt_vim {
@ -103,6 +103,6 @@ def modeline-parse -docstring "Read and interpret vi-format modelines at the beg
try %{ eval -draft %{ try %{ eval -draft %{
exec \%s\`|.\'<ret> %opt{modelines}k <a-x> %opt{modelines}X \ exec \%s\`|.\'<ret> %opt{modelines}k <a-x> %opt{modelines}X \
s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+<ret> s^[^\s]+?\s(vim?|kak(oune)?):\s?[^\n]+<ret>
eval -draft -itersel _modeline-parse eval -draft -itersel modeline-parse
} } } }
} }

View File

@ -55,7 +55,7 @@ def moon-alternative-file -docstring 'Jump to the alternate file (implementation
printf %s\\n "edit $altfile" printf %s\\n "edit $altfile"
}} }}
def -hidden _moon_filter_around_selections %{ def -hidden moon-filter-around-selections %{
eval -draft -itersel %{ eval -draft -itersel %{
exec <a-x> exec <a-x>
# remove trailing white spaces # remove trailing white spaces
@ -63,7 +63,7 @@ def -hidden _moon_filter_around_selections %{
} }
} }
def -hidden _moon_indent_on_char %{ def -hidden moon-indent-on-char %{
eval -draft -itersel %{ eval -draft -itersel %{
# align _else_ statements to start # align _else_ statements to start
try %{ exec -draft <a-x> <a-k> ^ \h * (else(if)?) $ <ret> <a-\;> <a-?> ^ \h * (if|unless|when) <ret> s \A | \Z <ret> \' <a-&> } try %{ exec -draft <a-x> <a-k> ^ \h * (else(if)?) $ <ret> <a-\;> <a-?> ^ \h * (if|unless|when) <ret> s \A | \Z <ret> \' <a-&> }
@ -74,14 +74,14 @@ def -hidden _moon_indent_on_char %{
} }
} }
def -hidden _moon_indent_on_new_line %{ def -hidden moon-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy -- comment prefix and following white spaces # copy -- comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^ \h * \K -- \h * <ret> y gh j P } try %{ exec -draft k <a-x> s ^ \h * \K -- \h * <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _moon_filter_around_selections <ret> } try %{ exec -draft k : moon-filter-around-selections <ret> }
# indent after start structure # indent after start structure
try %{ exec -draft k <a-x> <a-k> ^ \h * (class|else(if)?|for|if|switch|unless|when|while|with) \b | ([:=]|[-=]>) $ <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-k> ^ \h * (class|else(if)?|for|if|switch|unless|when|while|with) \b | ([:=]|[-=]>) $ <ret> j <a-gt> }
# deindent after return statements # deindent after return statements
@ -95,9 +95,9 @@ def -hidden _moon_indent_on_new_line %{
hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter ref moon } hook -group moon-highlight global WinSetOption filetype=moon %{ add-highlighter ref moon }
hook global WinSetOption filetype=moon %{ hook global WinSetOption filetype=moon %{
hook window InsertEnd .* -group moon-hooks _moon_filter_around_selections hook window InsertEnd .* -group moon-hooks moon-filter-around-selections
hook window InsertChar .* -group moon-indent _moon_indent_on_char hook window InsertChar .* -group moon-indent moon-indent-on-char
hook window InsertChar \n -group moon-indent _moon_indent_on_new_line hook window InsertChar \n -group moon-indent moon-indent-on-new-line
alias window alt moon-alternative-file alias window alt moon-alternative-file
} }

View File

@ -31,26 +31,26 @@ add-highlighter -group /php/code regex \b(__halt_compiler|abstract|and|array|as|
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _php_filter_around_selections %{ def -hidden php-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _php_indent_on_char %< def -hidden php-indent-on-char %<
eval -draft -itersel %< eval -draft -itersel %<
# align closer token to its opener when alone on a line # align closer token to its opener when alone on a line
try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> / try %/ exec -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \`|.\' <ret> 1<a-&> /
> >
> >
def -hidden _php_indent_on_new_line %< def -hidden php-indent-on-new-line %<
eval -draft -itersel %< eval -draft -itersel %<
# copy // comments prefix and following white spaces # copy // comments prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _php_filter_around_selections <ret> } try %{ exec -draft k : php-filter-around-selections <ret> }
# indent after lines beginning / ending with opener token # indent after lines beginning / ending with opener token
try %_ exec -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _ try %_ exec -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
> >
@ -62,9 +62,9 @@ def -hidden _php_indent_on_new_line %<
hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter ref php } hook -group php-highlight global WinSetOption filetype=php %{ add-highlighter ref php }
hook global WinSetOption filetype=php %{ hook global WinSetOption filetype=php %{
hook window InsertEnd .* -group php-hooks _php_filter_around_selections hook window InsertEnd .* -group php-hooks php-filter-around-selections
hook window InsertChar .* -group php-indent _php_indent_on_char hook window InsertChar .* -group php-indent php-indent-on-char
hook window InsertChar \n -group php-indent _php_indent_on_new_line hook window InsertChar \n -group php-indent php-indent-on-new-line
} }
hook -group php-highlight global WinSetOption filetype=(?!php).* %{ remove-highlighter php } hook -group php-highlight global WinSetOption filetype=(?!php).* %{ remove-highlighter php }

View File

@ -44,17 +44,17 @@ add-highlighter -group /pug/code regex ((?:\.[A-Za-z][A-Za-z0-9_-]
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _pug_filter_around_selections %{ def -hidden pug-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _pug_indent_on_new_line %{ def -hidden pug-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _pug_filter_around_selections <ret> } try %{ exec -draft k : pug-filter-around-selections <ret> }
# copy '//', '|', '-' or '(!)=' prefix and following whitespace # copy '//', '|', '-' or '(!)=' prefix and following whitespace
try %{ exec -draft k <a-x> s ^\h*\K[/|!=-]{1,2}\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K[/|!=-]{1,2}\h* <ret> y gh j P }
# indent unless we copied something above # indent unless we copied something above
@ -68,8 +68,8 @@ def -hidden _pug_indent_on_new_line %{
hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter ref pug } hook -group pug-highlight global WinSetOption filetype=pug %{ add-highlighter ref pug }
hook global WinSetOption filetype=pug %{ hook global WinSetOption filetype=pug %{
hook window InsertEnd .* -group pug-hooks _pug_filter_around_selections hook window InsertEnd .* -group pug-hooks pug-filter-around-selections
hook window InsertChar \n -group pug-indent _pug_indent_on_new_line hook window InsertChar \n -group pug-indent pug-indent-on-new-line
} }
hook -group pug-highlight global WinSetOption filetype=(?!pug).* %{ remove-highlighter pug } hook -group pug-highlight global WinSetOption filetype=(?!pug).* %{ remove-highlighter pug }

View File

@ -29,12 +29,12 @@ add-highlighter -group /ragel/code regex \b(action|alnum|alpha|any|ascii|case|cn
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _ragel_filter_around_selections %{ def -hidden ragel-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _ragel_indent_on_char %< def -hidden ragel-indent-on-char %<
eval -draft -itersel %< eval -draft -itersel %<
# align closer token to its opener when alone on a line # align closer token to its opener when alone on a line
try %< exec -draft <a-h> <a-k> ^\h+[]})]$ <ret> m s \`|.\' <ret> 1<a-&> > try %< exec -draft <a-h> <a-k> ^\h+[]})]$ <ret> m s \`|.\' <ret> 1<a-&> >
@ -42,14 +42,14 @@ def -hidden _ragel_indent_on_char %<
> >
> >
def -hidden _ragel_indent_on_new_line %< def -hidden ragel-indent-on-new-line %<
eval -draft -itersel %< eval -draft -itersel %<
# copy _#_ comment prefix and following white spaces # copy _#_ comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _ragel_filter_around_selections <ret> } try %{ exec -draft k : ragel-filter-around-selections <ret> }
# indent after lines ending with opener token # indent after lines ending with opener token
try %< exec -draft k <a-x> <a-k> [[{(*]$ <ret> j <a-gt> > try %< exec -draft k <a-x> <a-k> [[{(*]$ <ret> j <a-gt> >
> >
@ -61,9 +61,9 @@ def -hidden _ragel_indent_on_new_line %<
hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter ref ragel } hook -group ragel-highlight global WinSetOption filetype=ragel %{ add-highlighter ref ragel }
hook global WinSetOption filetype=ragel %{ hook global WinSetOption filetype=ragel %{
hook window InsertEnd .* -group ragel-hooks _ragel_filter_around_selections hook window InsertEnd .* -group ragel-hooks ragel-filter-around-selections
hook window InsertChar .* -group ragel-indent _ragel_indent_on_char hook window InsertChar .* -group ragel-indent ragel-indent-on-char
hook window InsertChar \n -group ragel-indent _ragel_indent_on_new_line hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line
} }
hook -group ragel-highlight global WinSetOption filetype=(?!ragel).* %{ remove-highlighter ragel } hook -group ragel-highlight global WinSetOption filetype=(?!ragel).* %{ remove-highlighter ragel }

View File

@ -29,19 +29,19 @@ add-highlighter -group /sass/code regex !important 0:keyword
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _sass_filter_around_selections %{ def -hidden sass-filter-around-selections %{
# remove trailing white spaces # remove trailing white spaces
try %{ exec -draft -itersel <a-x> s \h+$ <ret> d } try %{ exec -draft -itersel <a-x> s \h+$ <ret> d }
} }
def -hidden _sass_indent_on_new_line %{ def -hidden sass-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# copy '/' comment prefix and following white spaces # copy '/' comment prefix and following white spaces
try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y gh j P } try %{ exec -draft k <a-x> s ^\h*\K/\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \; K <a-&> } try %{ exec -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ exec -draft k : _sass_filter_around_selections <ret> } try %{ exec -draft k : sass-filter-around-selections <ret> }
# avoid indent after properties and comments # avoid indent after properties and comments
try %{ exec -draft k <a-x> <a-K> [:/] <ret> j <a-gt> } try %{ exec -draft k <a-x> <a-K> [:/] <ret> j <a-gt> }
} }
@ -53,8 +53,8 @@ def -hidden _sass_indent_on_new_line %{
hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter ref sass } hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter ref sass }
hook global WinSetOption filetype=sass %{ hook global WinSetOption filetype=sass %{
hook window InsertEnd .* -group sass-hooks _sass_filter_around_selections hook window InsertEnd .* -group sass-hooks sass-filter-around-selections
hook window InsertChar \n -group sass-indent _sass_indent_on_new_line hook window InsertChar \n -group sass-indent sass-indent-on-new-line
} }
hook -group sass-highlight global WinSetOption filetype=(?!sass).* %{ remove-highlighter sass } hook -group sass-highlight global WinSetOption filetype=(?!sass).* %{ remove-highlighter sass }

View File

@ -22,9 +22,9 @@ add-highlighter -group /scss regex @[A-Za-z][A-Za-z0-9_-]* 0:meta
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _scss_filter_around_selections _css_filter_around_selections def -hidden scss-filter-around-selections css-filter-around-selections
def -hidden _scss_indent_on_new_line _css_indent_on_new_line def -hidden scss-indent-on-new-line css-indent-on-new-line
def -hidden _scss_indent_on_closing_curly_brace _css_indent_on_closing_curly_brace def -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace
# Initialization # Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -32,9 +32,9 @@ def -hidden _scss_indent_on_closing_curly_brace _css_indent_on_closing_curly_bra
hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter ref scss } hook -group scss-highlight global WinSetOption filetype=scss %{ add-highlighter ref scss }
hook global WinSetOption filetype=scss %[ hook global WinSetOption filetype=scss %[
hook window InsertEnd .* -group scss-hooks _scss_filter_around_selections hook window InsertEnd .* -group scss-hooks scss-filter-around-selections
hook window InsertChar \n -group scss-indent _scss_indent_on_new_line hook window InsertChar \n -group scss-indent scss-indent-on-new-line
hook window InsertChar \} -group scss-indent _scss_indent_on_closing_curly_brace hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
] ]
hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ remove-highlighter scss } hook -group scss-highlight global WinSetOption filetype=(?!scss).* %{ remove-highlighter scss }

View File

@ -22,7 +22,7 @@ add-highlighter -group /taskpaper regex (([a-z]+://\S+)|((mailto:)[\w+-]+@\S+))
# Commands # Commands
# ‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾
def -hidden _taskpaper-indent-on-new-line %{ def -hidden taskpaper-indent-on-new-line %{
eval -draft -itersel %{ eval -draft -itersel %{
# preserve previous line indent # preserve previous line indent
try %{ exec -draft \;K<a-&> } try %{ exec -draft \;K<a-&> }
@ -38,7 +38,7 @@ def -hidden _taskpaper-indent-on-new-line %{
hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{ hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{
add-highlighter ref taskpaper add-highlighter ref taskpaper
hook window InsertChar \n -group taskpaper-indent _taskpaper-indent-on-new-line hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line
} }
hook -group taskpaper-highlight global WinSetOption filetype=(?!taskpaper).* %{ hook -group taskpaper-highlight global WinSetOption filetype=(?!taskpaper).* %{
remove-highlighter taskpaper remove-highlighter taskpaper

View File

@ -10,12 +10,12 @@ hook global KakBegin .* %{
if [ "${VERSION_TMUX}" -gt 1 ]; then if [ "${VERSION_TMUX}" -gt 1 ]; then
echo " echo "
alias global repl tmux-repl-horizontal alias global repl tmux-repl-horizontal
alias global send-text _tmux-send-text alias global send-text tmux-send-text
" "
else else
echo " echo "
alias global repl _tmux-repl-disabled alias global repl tmux-repl-disabled
alias global send-text _tmux-repl-disabled alias global send-text tmux-repl-disabled
" "
fi fi
fi fi
@ -49,7 +49,7 @@ def tmux-repl-window -params 0..1 -command-completion -docstring "Create a new w
tmux-repl-impl 'new-window' %arg{@} tmux-repl-impl 'new-window' %arg{@}
} }
def -hidden _tmux-send-text -docstring "Send the selected text to the repl pane" %{ def -hidden tmux-send-text -docstring "Send the selected text to the repl pane" %{
nop %sh{ nop %sh{
tmux set-buffer -b kak_selection "${kak_selection}" tmux set-buffer -b kak_selection "${kak_selection}"
kak_orig_window=$(tmux display-message -p '#I') kak_orig_window=$(tmux display-message -p '#I')
@ -62,7 +62,7 @@ def -hidden _tmux-send-text -docstring "Send the selected text to the repl pane"
} }
} }
def -hidden _tmux-repl-disabled %{ %sh{ def -hidden tmux-repl-disabled %{ %sh{
VERSION_TMUX=$(tmux -V) VERSION_TMUX=$(tmux -V)
printf %s "echo -color Error %{The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}" printf %s "echo -color Error %{The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}"
} } } }