diff --git a/comp.go b/comp.go index 899b621..df196b8 100644 --- a/comp.go +++ b/comp.go @@ -36,6 +36,7 @@ var ( "yank", "delete", "put", + "clear", "renew", "sync", "echo", diff --git a/doc.go b/doc.go index a85de96..6b14462 100644 --- a/doc.go +++ b/doc.go @@ -32,6 +32,7 @@ The following commands are provided by lf with default keybindings. toggle (default "") invert (default "v") yank (default "y") + clear (default "c") delete (default "d") put (default "p") renew (default "") diff --git a/docstring.go b/docstring.go index 15abf9b..ffaa8de 100644 --- a/docstring.go +++ b/docstring.go @@ -36,6 +36,7 @@ The following commands are provided by lf with default keybindings. toggle (default "") invert (default "v") yank (default "y") + clear (default "c") delete (default "d") put (default "p") renew (default "") diff --git a/eval.go b/eval.go index f4a7626..a5bbe4f 100644 --- a/eval.go +++ b/eval.go @@ -303,6 +303,18 @@ func (e *callExpr) eval(app *app, args []string) { app.nav.save(false) app.nav.saves = make(map[string]bool) saveFiles(nil, false) + case "clear": + if err := saveFiles(nil, false); err != nil { + msg := fmt.Sprintf("clear: %s", err) + app.ui.message = msg + log.Printf(msg) + return + } + if err := sendRemote("send sync"); err != nil { + msg := fmt.Sprintf("clear: %s", err) + app.ui.message = msg + log.Printf(msg) + } case "renew": app.ui.sync() app.ui.renew() diff --git a/opts.go b/opts.go index 0ced816..ee546d5 100644 --- a/opts.go +++ b/opts.go @@ -58,6 +58,7 @@ func init() { gOpts.keys["v"] = &callExpr{"invert", nil} gOpts.keys["y"] = &callExpr{"yank", nil} gOpts.keys["d"] = &callExpr{"delete", nil} + gOpts.keys["c"] = &callExpr{"clear", nil} gOpts.keys["p"] = &callExpr{"put", nil} gOpts.keys[""] = &callExpr{"renew", nil}