'toggle' command now toggles selection on its arguments when at least one (#409)
* 'toggle' command now toggles selection on its arguments when given and some cleanup * update doc
This commit is contained in:
parent
001ee5bfae
commit
75e59cdd08
3
doc.go
3
doc.go
@ -63,7 +63,8 @@ The following commands are provided by lf without default keybindings:
|
||||
echoerr same as echomsg but red color
|
||||
cd change working directory to the argument
|
||||
select change current file selection to the argument
|
||||
toggle toggle the selection of the current file
|
||||
toggle toggle the selection of the current file or,
|
||||
when passed arguments, of its arguments
|
||||
glob-select select files that match the given glob
|
||||
glob-unselect unselect files that match the given glob
|
||||
source read the configuration file in the argument
|
||||
|
@ -66,7 +66,8 @@ The following commands are provided by lf without default keybindings:
|
||||
echoerr same as echomsg but red color
|
||||
cd change working directory to the argument
|
||||
select change current file selection to the argument
|
||||
toggle toggle the selection of the current file
|
||||
toggle toggle the selection of the current file or,
|
||||
when passed arguments, of its arguments
|
||||
glob-select select files that match the given glob
|
||||
glob-unselect unselect files that match the given glob
|
||||
source read the configuration file in the argument
|
||||
|
16
eval.go
16
eval.go
@ -683,15 +683,21 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
app.ui.loadFile(app.nav)
|
||||
app.ui.loadFileInfo(app.nav)
|
||||
case "toggle":
|
||||
app.nav.toggle()
|
||||
app.ui.loadFile(app.nav)
|
||||
app.ui.loadFileInfo(app.nav)
|
||||
if len(e.args) == 0 {
|
||||
app.nav.toggle()
|
||||
} else {
|
||||
for _, path := range e.args {
|
||||
if _, err := os.Stat(path); err == nil {
|
||||
app.nav.toggleSelection(path)
|
||||
} else {
|
||||
log.Printf("toggle: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
case "invert":
|
||||
app.nav.invert()
|
||||
app.ui.loadFileInfo(app.nav)
|
||||
case "unselect":
|
||||
app.nav.unselect()
|
||||
app.ui.loadFileInfo(app.nav)
|
||||
case "copy":
|
||||
if err := app.nav.save(true); err != nil {
|
||||
app.ui.echoerrf("copy: %s", err)
|
||||
|
3
lf.1
3
lf.1
@ -75,7 +75,8 @@ The following commands are provided by lf without default keybindings:
|
||||
echoerr same as echomsg but red color
|
||||
cd change working directory to the argument
|
||||
select change current file selection to the argument
|
||||
toggle toggle the selection of the current file
|
||||
toggle toggle the selection of the current file or,
|
||||
when passed arguments, of its arguments
|
||||
glob-select select files that match the given glob
|
||||
glob-unselect unselect files that match the given glob
|
||||
source read the configuration file in the argument
|
||||
|
Loading…
Reference in New Issue
Block a user