I want to use Ck to kill a block or kill the remaining current line in js mode.
After I searched Google for a while, I think defadvice will be the answer, but I am not familiar with elisp. So I hope someone can help me write :)
The function I mentioned is similar to paredit-mode , but I don't want to include paredit-mode in js-mode , since my requirements will be much simpler. When I write js, sometimes I want to kill the following block, for example:
function test() { if () { } else { } }
If the cursor is between function and test , then I use Ck , I can kill the whole block
test() { if () { } else { } }
with a single word function on the left. Here, "block" simply means something between "{}".
If the current line does not match the block, Ck should behave as its origin, which should be (kill-line &optional ARG) , by default, delete the rest of the line.
If you are familiar with paredit-mode , you will find it just a very simple version!
I hope you understand what I mean, as my English is broken. Any help would be greatly appreciated!
source share