unmap a binding or delete a command when expression is empty
With this commit `map`/`cmd` keywords are also used to remove a binding/command by leaving the expression part empty (e.g. `map j` removes keybinding for `j` or `cmd trash` removes `trash` command). Mentioned in #16.
This commit is contained in:
parent
7fc93313bc
commit
cd63dc1872
8
eval.go
8
eval.go
@ -106,10 +106,18 @@ func (e *SetExpr) eval(app *App, args []string) {
|
||||
}
|
||||
|
||||
func (e *MapExpr) eval(app *App, args []string) {
|
||||
if e.expr == nil {
|
||||
delete(gOpts.keys, e.keys)
|
||||
return
|
||||
}
|
||||
gOpts.keys[e.keys] = e.expr
|
||||
}
|
||||
|
||||
func (e *CmdExpr) eval(app *App, args []string) {
|
||||
if e.expr == nil {
|
||||
delete(gOpts.cmds, e.name)
|
||||
return
|
||||
}
|
||||
gOpts.cmds[e.name] = e.expr
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user