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

Function paneMapBindings

packages/app-core/src/components/Editor.tsx:128–144  ·  view source on GitHub ↗
(overrides: KeymapOverrides, actionId: KeymapId)

Source from the content-addressed store, hash-verified

126}
127
128function paneMapBindings(overrides: KeymapOverrides, actionId: KeymapId): string[] {
129 const prefixBinding = toVimSequence(getKeymapBinding(overrides, 'vim.panePrefix'))
130 const actionBinding = toVimSequence(getKeymapBinding(overrides, actionId))
131 if (!prefixBinding || !actionBinding) return []
132 const bindings = [`${prefixBinding}${actionBinding}`]
133 const prefixTokens = getSequenceTokens(overrides, 'vim.panePrefix')
134 const actionTokens = getSequenceTokens(overrides, actionId)
135 if (
136 prefixTokens.length === 1 &&
137 prefixTokens[0] === 'Ctrl+W' &&
138 actionTokens.length === 1 &&
139 /^[hjkl]$/i.test(actionTokens[0])
140 ) {
141 bindings.push(`${prefixBinding}<C-${actionTokens[0].toLowerCase()}>`)
142 }
143 return [...new Set(bindings)]
144}
145
146/**
147 * Clamped half-page scroll for the editor, bound to Ctrl+D / Ctrl+U.

Callers 1

syncVimKeymapsFunction · 0.85

Calls 3

getKeymapBindingFunction · 0.90
getSequenceTokensFunction · 0.90
toVimSequenceFunction · 0.85

Tested by

no test coverage detected