From 2bc14edfd275ca739680982874e9ebc8702714f7 Mon Sep 17 00:00:00 2001 From: hacktivista Date: Sun, 9 Jun 2019 23:04:13 -0400 Subject: [PATCH] Fix PHP comments indentation --- rc/filetype/php.kak | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 8ee1d8ce..7c553f80 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -83,14 +83,16 @@ define-command -hidden php-indent-on-char %< define-command -hidden php-indent-on-new-line %< evaluate-commands -draft -itersel %< - # copy // comments prefix and following white spaces - try %{ execute-keys -draft k s ^\h*\K#\h* y gh j P } + # copy // comments or docblock * prefix and following white spaces + try %{ execute-keys -draft k s ^\h*\K(?://|[*])\h* y gh j P } # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line try %{ execute-keys -draft k : php-trim-indent } # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ + # append " * " on lines starting a multiline /** or /* comment + try %{ execute-keys -draft k s ^\h*/[*][* ]? j gi i * } > >