diff --git a/doc.go b/doc.go index c688063..58ab19e 100644 --- a/doc.go +++ b/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 diff --git a/docstring.go b/docstring.go index 1cbf054..576a4a3 100644 --- a/docstring.go +++ b/docstring.go @@ -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 diff --git a/eval.go b/eval.go index b8c4481..b4bda50 100644 --- a/eval.go +++ b/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) diff --git a/lf.1 b/lf.1 index d8e8a62..0d7a5f9 100644 --- a/lf.1 +++ b/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