I'm trying to create a vim key-binding that mimic emacs CTL-K:
- If used at the end of a line, it kills the line-ending newline character, merging the next line into the current one (thus, a blank line is entirely removed).
- Otherwise, C-k kills all the text from point up to the end of the line;
- if point was originally at the beginning of the line, this leaves the line blank.
I saw an answer at https://unix.stackexchange.com/a/301584/137686 recommending the following
inoremap <C-K> <Esc>lDa
It seems to work for case 2, but not for case 1 (it won't delete the newline character) or 3 (it will leave the first character in the line). Any recommendation on how I can improve the mapping to achieve all three?