add clear command to clear file selection

Mentioned in #45.
This commit is contained in:
Gokcehan 2016-12-19 21:53:47 +03:00
parent 0298630114
commit 563fae38d2
5 changed files with 16 additions and 0 deletions

View File

@ -36,6 +36,7 @@ var (
"yank",
"delete",
"put",
"clear",
"renew",
"sync",
"echo",

1
doc.go
View File

@ -32,6 +32,7 @@ The following commands are provided by lf with default keybindings.
toggle (default "<space>")
invert (default "v")
yank (default "y")
clear (default "c")
delete (default "d")
put (default "p")
renew (default "<c-l>")

View File

@ -36,6 +36,7 @@ The following commands are provided by lf with default keybindings.
toggle (default "<space>")
invert (default "v")
yank (default "y")
clear (default "c")
delete (default "d")
put (default "p")
renew (default "<c-l>")

12
eval.go
View File

@ -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()

View File

@ -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["<c-l>"] = &callExpr{"renew", nil}