From 2bc14edfd275ca739680982874e9ebc8702714f7 Mon Sep 17 00:00:00 2001 From: hacktivista Date: Sun, 9 Jun 2019 23:04:13 -0400 Subject: [PATCH 1/3] 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 * } > > From f246313951b5e9bd27a79d494576bc610413dbb2 Mon Sep 17 00:00:00 2001 From: Felix Freeman Date: Mon, 10 Jun 2019 12:12:06 -0400 Subject: [PATCH 3/3] Consider */ closing comment on PHP automatic indentation prefix --- rc/filetype/php.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 7c553f80..d25d22ab 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -84,7 +84,7 @@ define-command -hidden php-indent-on-char %< define-command -hidden php-indent-on-new-line %< evaluate-commands -draft -itersel %< # copy // comments or docblock * prefix and following white spaces - try %{ execute-keys -draft k s ^\h*\K(?://|[*])\h* y gh j P } + try %{ execute-keys -draft s [^/] k s ^\h*\K(?://|[*][^/])\h* y gh j P } # preserve previous line indent try %{ execute-keys -draft \; K } # filter previous line