From c4ddc7229bc59154d21779fb43b549ad8f59b1b5 Mon Sep 17 00:00:00 2001 From: Nisarg Jasani Date: Thu, 13 Aug 2026 19:20:49 -0400 Subject: [PATCH] Add duplicate-line and scroll-without-moving-cursor shortcuts --- .../IDE/components/Editor/utils/keymaps.js | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/client/modules/IDE/components/Editor/utils/keymaps.js b/client/modules/IDE/components/Editor/utils/keymaps.js index bafe6ae136..a8fd8e501e 100644 --- a/client/modules/IDE/components/Editor/utils/keymaps.js +++ b/client/modules/IDE/components/Editor/utils/keymaps.js @@ -10,7 +10,8 @@ import { historyKeymap, indentWithTab, moveLineUp, - moveLineDown + moveLineDown, + copyLineDown } from '@codemirror/commands'; import { foldKeymap } from '@codemirror/language'; import { searchKeymap } from '@codemirror/search'; @@ -77,6 +78,11 @@ export function openColorPickerWithKeyboard(view) { return true; } +function scrollLine(view, direction) { + view.scrollDOM.scrollTop += direction * view.defaultLineHeight; + return true; +} + // Extra custom keymaps. // TODO: We need to add sublime mappings + other missing extra mappings here. export const extraKeymaps = [ @@ -87,7 +93,18 @@ export const extraKeymaps = [ { key: 'ArrowRight', run: focusOnReferenceArrow }, indentWithTab, { key: 'Ctrl-Shift-ArrowUp', mac: 'Cmd-Ctrl-ArrowUp', run: moveLineUp }, - { key: 'Ctrl-Shift-ArrowDown', mac: 'Cmd-Ctrl-ArrowDown', run: moveLineDown } + { key: 'Ctrl-Shift-ArrowDown', mac: 'Cmd-Ctrl-ArrowDown', run: moveLineDown }, + { key: 'Shift-Ctrl-d', mac: 'Shift-Cmd-d', run: copyLineDown }, + { + key: 'Ctrl-ArrowUp', + mac: 'Ctrl-Alt-ArrowUp', + run: (view) => scrollLine(view, -1) + }, + { + key: 'Ctrl-ArrowDown', + mac: 'Ctrl-Alt-ArrowDown', + run: (view) => scrollLine(view, 1) + } ]; export const emmetKeymaps = [{ key: 'Tab', run: expandAbbreviation }];