From 8867e40929d81791d508bb2c767ff185dace3e34 Mon Sep 17 00:00:00 2001 From: Dmitry Matveyev Date: Sun, 6 Jun 2021 01:05:45 +0600 Subject: [PATCH] Fix elixir copying comment # sign Elixir uses # for comments, not --. Implementation is copied from Nim. --- rc/filetype/elixir.kak | 4 ++-- test/indent/elixir/insert-comment-hash/cmd | 1 + test/indent/elixir/insert-comment-hash/in | 1 + test/indent/elixir/insert-comment-hash/out | 2 ++ test/indent/elixir/insert-comment-hash/rc | 3 +++ 5 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 test/indent/elixir/insert-comment-hash/cmd create mode 100644 test/indent/elixir/insert-comment-hash/in create mode 100644 test/indent/elixir/insert-comment-hash/out create mode 100644 test/indent/elixir/insert-comment-hash/rc diff --git a/rc/filetype/elixir.kak b/rc/filetype/elixir.kak index 5b215942..2485d733 100644 --- a/rc/filetype/elixir.kak +++ b/rc/filetype/elixir.kak @@ -94,8 +94,8 @@ define-command -hidden elixir-trim-indent %{ define-command -hidden elixir-insert-on-new-line %[ evaluate-commands -no-hooks -draft -itersel %[ - # copy -- comments prefix and following white spaces - try %{ execute-keys -draft k s ^\h*\K--\h* y gh j P } + # copy '#' comment prefix and following white spaces + try %{ exec -draft k s ^\h*#\h* y jgh P } # wisely add end structure evaluate-commands -save-regs x %[ try %{ execute-keys -draft k s ^ \h + \" x y } catch %{ reg x '' } diff --git a/test/indent/elixir/insert-comment-hash/cmd b/test/indent/elixir/insert-comment-hash/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/elixir/insert-comment-hash/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/elixir/insert-comment-hash/in b/test/indent/elixir/insert-comment-hash/in new file mode 100644 index 00000000..9072f4db --- /dev/null +++ b/test/indent/elixir/insert-comment-hash/in @@ -0,0 +1 @@ +# Comment %( )comment2 diff --git a/test/indent/elixir/insert-comment-hash/out b/test/indent/elixir/insert-comment-hash/out new file mode 100644 index 00000000..bde83b7a --- /dev/null +++ b/test/indent/elixir/insert-comment-hash/out @@ -0,0 +1,2 @@ +# Comment +# comment2 diff --git a/test/indent/elixir/insert-comment-hash/rc b/test/indent/elixir/insert-comment-hash/rc new file mode 100644 index 00000000..5cc4387c --- /dev/null +++ b/test/indent/elixir/insert-comment-hash/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/elixir.kak" +set buffer filetype elixir