MCPcopy Index your code
hub / github.com/anomalyco/opencode / SettingsKeybinds

Function SettingsKeybinds

packages/app/src/components/settings-keybinds.tsx:272–560  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

270}
271
272export const SettingsKeybinds: Component<{ v2?: boolean }> = (props) => {
273 const command = useCommand()
274 const language = useLanguage()
275 const settings = useSettings()
276
277 const [store, setStore] = createStore({
278 active: null as string | null,
279 filter: "",
280 })
281
282 const stop = () => {
283 if (!store.active) return
284 setStore("active", null)
285 command.keybinds(true)
286 }
287
288 const start = (id: string) => {
289 if (store.active === id) {
290 stop()
291 return
292 }
293
294 if (store.active) stop()
295
296 setStore("active", id)
297 command.keybinds(false)
298 }
299
300 const map = createMemo(() => keybinds(settings.current.keybinds))
301
302 const hasOverrides = createMemo(() => Object.values(map()).some((x) => typeof x === "string"))
303
304 const resetAll = () => {
305 stop()
306 settings.keybinds.resetAll()
307 showToast({
308 title: language.t("settings.shortcuts.reset.toast.title"),
309 description: language.t("settings.shortcuts.reset.toast.description"),
310 })
311 }
312
313 const list = createMemo(() => {
314 language.locale()
315 return listFor(command, map(), language.t("command.palette"))
316 })
317
318 const title = (id: string) => list().get(id)?.title ?? ""
319
320 const grouped = createMemo(() => groupedFor(list()))
321
322 const filtered = createMemo(() => {
323 return filteredFor(store.filter, list(), grouped(), (id) => command.keybind(id) || "")
324 })
325
326 const hasResults = createMemo(() => {
327 for (const group of GROUPS) {
328 const ids = filtered().get(group) ?? []
329 if (ids.length > 0) return true

Callers

nothing calls this directly

Calls 15

listForFunction · 0.85
groupedForFunction · 0.85
filteredForFunction · 0.85
groupedFunction · 0.85
filteredFunction · 0.85
signaturesFunction · 0.85
valueForFunction · 0.85
useKeyCaptureFunction · 0.85
setStoreFunction · 0.85
keybindsFunction · 0.70
addFunction · 0.70
titleFunction · 0.70

Tested by

no test coverage detected