How to bind ctrl-k to kill line?


#1

I like how ctrl-k works in Emacs, cutting the text from the cursor to the end of the line into the clipboard. Is there a keymap.cson snippet that can replace all the premade ctr-k chords with this Emacs-like behavior instead?


#2

No, because keymap.cson doesn’t contain any code. You need to add your command to init.coffee before you can make a keybinding for it.

editor.selectToEndOfLine() is the method you want to use to select your text. Make sure to account for the possibility of having multiple cursors. Every Cursor always has an implicit 0-length Selection, and every Selection has a Cursor.