summaryrefslogtreecommitdiff
path: root/rc/base/javascript.kak
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-01-11 13:56:48 +0000
committerMaxime Coste <mawww@kakoune.org>2017-01-11 13:56:48 +0000
commit5989903e7c492b90045aa8db778694d2c442429c (patch)
tree3c46ae4dae571b96595337d71c49672c621fc0bc /rc/base/javascript.kak
parent8c55acb07659d7406b4077b9e3a5bbe9cc035d21 (diff)
Copy comments *before* copying indentation
Fixes #1118
Diffstat (limited to 'rc/base/javascript.kak')
-rw-r--r--rc/base/javascript.kak4
1 files changed, 2 insertions, 2 deletions
diff --git a/rc/base/javascript.kak b/rc/base/javascript.kak
index a2ca6473..81168104 100644
--- a/rc/base/javascript.kak
+++ b/rc/base/javascript.kak
@@ -51,12 +51,12 @@ def -hidden _javascript_indent_on_char %<
def -hidden _javascript_indent_on_new_line %<
eval -draft -itersel %<
+ # copy // comments prefix and following white spaces
+ try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
# preserve previous line indent
try %{ exec -draft <space> K <a-&> }
# filter previous line
try %{ exec -draft k : _javascript_filter_around_selections <ret> }
- # copy // comments prefix and following white spaces
- try %{ exec -draft k x s ^\h*\K#\h* <ret> y gh j P }
# indent after lines beginning / ending with opener token
try %_ exec -draft k x <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
>