MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / buildEditorKeymap

Function buildEditorKeymap

packages/app-core/src/components/EditorPane.tsx:266–288  ·  view source on GitHub ↗
(vimMode: boolean, overrides: KeymapOverrides)

Source from the content-addressed store, hash-verified

264// cm-vim-default-keymap). Built behind a compartment and reconfigured on Vim
265// toggle or keymap-override changes.
266function buildEditorKeymap(vimMode: boolean, overrides: KeymapOverrides): Extension {
267 return keymap.of([
268 {
269 key: 'Mod-f',
270 run: () => {
271 const state = useStore.getState()
272 if (state.vimMode) return false
273 state.setSearchOpen(true)
274 return true
275 }
276 },
277 // Move the current line (or selection) up/down — reorders the markdown so
278 // it persists in the file. Listed before defaultKeymap so the configured
279 // binding wins; works in Vim normal/insert and non-Vim alike.
280 { key: toCmKey(getKeymapBinding(overrides, 'editor.moveLineUp')), run: moveLineUp },
281 { key: toCmKey(getKeymapBinding(overrides, 'editor.moveLineDown')), run: moveLineDown },
282 indentWithTab,
283 ...vimAwareDefaultKeymap(vimMode),
284 ...historyKeymap,
285 ...searchKeymap,
286 ...completionKeymap
287 ])
288}
289
290function markdownEditingExtensions(): Extension[] {
291 return [

Callers 1

EditorPaneFunction · 0.85

Calls 3

getKeymapBindingFunction · 0.90
vimAwareDefaultKeymapFunction · 0.90
toCmKeyFunction · 0.85

Tested by

no test coverage detected