MCPcopy
hub / github.com/micro-editor/micro / TryBindKeyPlug

Function TryBindKeyPlug

internal/action/bindings.go:266–271  ·  view source on GitHub ↗

TryBindKeyPlug tries to bind a key for the plugin without writing to bindings.json. This operation can be rejected by lockbindings to prevent unexpected actions by the user.

(k, v string, overwrite bool)

Source from the content-addressed store, hash-verified

264// TryBindKeyPlug tries to bind a key for the plugin without writing to bindings.json.
265// This operation can be rejected by lockbindings to prevent unexpected actions by the user.
266func TryBindKeyPlug(k, v string, overwrite bool) (bool, error) {
267 if l, ok := config.GlobalSettings["lockbindings"]; ok && l.(bool) {
268 return false, errors.New("bindings is locked by the user")
269 }
270 return TryBindKey(k, v, overwrite, false)
271}
272
273// TryBindKey tries to bind a key by writing to config.ConfigDir/bindings.json
274// Returns true if the keybinding already existed or is binded successfully and a possible error

Callers

nothing calls this directly

Calls 1

TryBindKeyFunction · 0.85

Tested by

no test coverage detected