Comment line(s) and paste uncommented

It’s a simple trick I got used to in spacemacs, so implemented the same in kakoune:

map -docstring "comment and paste" \
 global user '#' %{: exec -save-regs '"' <lt>a-s>gixy:<lt>space>comment-line<lt>ret><lt>space><lt>a-p><lt>a-_><ret>}
1 Like

It’s not working for me. Should it make a copy of the current line before commenting?

Do you have comment-line command? It should be built-in I suppose.
Yes it yanks a line, comments it and then pastes original line below.

Not sure why it’s not working for you, btw I use master version of kakoune.

Nevermind, I didn’t notice I was mapping it in the user mode.