kommentary icon indicating copy to clipboard operation
kommentary copied to clipboard

Feature request: mapping to append comment to current line

Open mawkler opened this issue 3 years ago • 1 comments

NERDCommenter has the ability to append a comment to the current line, which I find really useful.

The default mapping is <leader>cA and it appends comment delimiter(s) to the end of the line and leave you in insert mode so you can start typing your comment.

I would love it if this feature were available in kommentary.

mawkler avatar Jul 26 '21 15:07 mawkler

Agree that this would be nice to have, for the moment I implemented it myself:

function! AppendComment()
  let commentChar = split(&commentstring, '%s')[0]
  execute 'normal! A ' . commentChar . ' '
  startinsert!
endfunction
nnoremap  <silent> <leader>C  :call AppendComment()<CR>

jebaum avatar Jul 28 '21 16:07 jebaum

Hi, thanks for your interest in kommentary, unfortunately I'll not be adding any new features, I'm sorry I never got to this issue.

If anybody is still interested in this, you can achieve this by defining a custom function, see https://github.com/b3nj5m1n/kommentary#advanced-configuration.

b3nj5m1n avatar Nov 05 '22 04:11 b3nj5m1n