Fix PHP comments indentation

This commit is contained in:
hacktivista 2019-06-09 23:04:13 -04:00 committed by Felix Freeman
parent 09e1ec97a9
commit 2bc14edfd2

View File

@ -83,14 +83,16 @@ define-command -hidden php-indent-on-char %<
define-command -hidden php-indent-on-new-line %< define-command -hidden php-indent-on-new-line %<
evaluate-commands -draft -itersel %< evaluate-commands -draft -itersel %<
# copy // comments prefix and following white spaces # copy // comments or docblock * prefix and following white spaces
try %{ execute-keys -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P } try %{ execute-keys -draft k <a-x> s ^\h*\K(?://|[*])\h* <ret> y gh j P }
# preserve previous line indent # preserve previous line indent
try %{ execute-keys -draft \; K <a-&> } try %{ execute-keys -draft \; K <a-&> }
# filter previous line # filter previous line
try %{ execute-keys -draft k : php-trim-indent <ret> } try %{ execute-keys -draft k : php-trim-indent <ret> }
# indent after lines beginning / ending with opener token # indent after lines beginning / ending with opener token
try %_ execute-keys -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _ try %_ execute-keys -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
# append " * " on lines starting a multiline /** or /* comment
try %{ execute-keys -draft k <a-x> s ^\h*/[*][* ]? <ret> j gi i <space>*<space> }
> >
> >