Skip to content

Commit cea6eae

Browse files
committed
Add customized killLine behaviour
Useful for registering a visual-line-mode killLine for example.
1 parent 452cb4c commit cea6eae

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,11 +720,15 @@ EmacsHandler.addCommands({
720720
},
721721
},
722722
killLine: {
723-
exec: function (handler: EmacsHandler) {
723+
exec: function (handler: EmacsHandler, selectionCommand?: (view: EditorView) => any) {
724724
handler.pushEmacsMark(null);
725725
// don't delete the selection if it's before the cursor
726726
handler.clearSelection();
727-
commands.selectLineEnd(handler.view);
727+
if (selectionCommand) {
728+
selectionCommand(handler.view);
729+
} else {
730+
commands.selectLineEnd(handler.view);
731+
}
728732

729733
var view = handler.view;
730734
var state = view.state

0 commit comments

Comments
 (0)