mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Adding functionality to unbind keys
* adds new special-case keybinding to remove an existing default key binding. * hides the show/close help text in the status line when no key is assigned to "ToggleHelp" * updating documentation
This commit is contained in:
@@ -346,14 +346,21 @@ func BindKey(k, v string) {
|
||||
if v == "ToggleHelp" {
|
||||
helpBinding = k
|
||||
}
|
||||
|
||||
actionNames := strings.Split(v, ",")
|
||||
actions := make([]func(*View, bool) bool, 0, len(actionNames))
|
||||
for _, actionName := range actionNames {
|
||||
actions = append(actions, findAction(actionName))
|
||||
if helpBinding == k && v != "ToggleHelp" {
|
||||
helpBinding = ""
|
||||
}
|
||||
|
||||
if v == "UnbindKey" {
|
||||
delete(bindings, key)
|
||||
} else {
|
||||
actionNames := strings.Split(v, ",")
|
||||
actions := make([]func(*View, bool) bool, 0, len(actionNames))
|
||||
for _, actionName := range actionNames {
|
||||
actions = append(actions, findAction(actionName))
|
||||
}
|
||||
|
||||
bindings[key] = actions
|
||||
bindings[key] = actions
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultBindings returns a map containing micro's default keybindings
|
||||
|
||||
Reference in New Issue
Block a user