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

Function runFold

packages/app-core/src/components/Editor.tsx:856–861  ·  view source on GitHub ↗
(cmd: (view: { state: unknown; dispatch: unknown }) => boolean)

Source from the content-addressed store, hash-verified

854 // note. We map vim's `zc` / `zo` / `zM` / `zR` keys explicitly so the
855 // advertised fold chords work regardless of what CM-Vim ships by default.
856 const runFold = (cmd: (view: { state: unknown; dispatch: unknown }) => boolean): void => {
857 const view = useStore.getState().editorViewRef
858 if (!view) return
859 cmd(view as unknown as Parameters<typeof foldCode>[0])
860 view.focus()
861 }
862 Vim.defineAction('foldHeadingAtCursor', () => runFold(foldCode as never))
863 Vim.defineAction('unfoldHeadingAtCursor', () => runFold(unfoldCode as never))
864 Vim.defineAction('foldAllHeadings', () => runFold(foldAll as never))

Callers 1

registerVimNoteCommandsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected