diff --git a/comp.go b/comp.go index 92166bc..c18eb27 100644 --- a/comp.go +++ b/comp.go @@ -32,7 +32,7 @@ var ( "delete", "put", "clear", - "renew", + "reload", "read", "read-shell", "read-shell-wait", diff --git a/doc.go b/doc.go index eaf411c..4660dc5 100644 --- a/doc.go +++ b/doc.go @@ -30,7 +30,7 @@ The following commands are provided by lf with default keybindings: delete (default 'd') put (default 'p') clear (default 'c') - renew (default '') + reload (default '') read (default ':') read-shell (default '$') read-shell-wait (default '!') @@ -352,7 +352,7 @@ implementation. The default behavior is similar to the following command: elif [ $mode = 'move' ]; then mv -n $list . fi - lf -remote "send $id renew" + lf -remote "send $id reload" lf -remote "$(printf 'save\nmove\n\n')" lf -remote "send sync" }} diff --git a/docstring.go b/docstring.go index 3a9640e..27dd99e 100644 --- a/docstring.go +++ b/docstring.go @@ -34,7 +34,7 @@ The following commands are provided by lf with default keybindings: delete (default 'd') put (default 'p') clear (default 'c') - renew (default '') + reload (default '') read (default ':') read-shell (default '$') read-shell-wait (default '!') @@ -366,7 +366,7 @@ implementation. The default behavior is similar to the following command: elif [ $mode = 'move' ]; then mv -n $list . fi - lf -remote "send $id renew" + lf -remote "send $id reload" lf -remote "$(printf 'save\nmove\n\n')" lf -remote "send sync" }} diff --git a/eval.go b/eval.go index ade44df..08f352f 100644 --- a/eval.go +++ b/eval.go @@ -332,10 +332,10 @@ func (e *callExpr) eval(app *app, args []string) { if err := sendRemote("send sync"); err != nil { app.ui.printf("clear: %s", err) } - case "renew": + case "reload": app.ui.sync() app.ui.renew() - app.nav.renew(app.ui.wins[0].h) + app.nav.reload() case "read": app.ui.cmdPrefix = ":" case "read-shell": diff --git a/nav.go b/nav.go index dc1f43f..2d17402 100644 --- a/nav.go +++ b/nav.go @@ -300,6 +300,17 @@ func (nav *nav) renew(height int) { } } +func (nav *nav) reload() { + nav.dirCache = make(map[string]*dir) + + wd, err := os.Getwd() + if err != nil { + log.Printf("getting current directory: %s", err) + } + + nav.getDirs(wd) +} + func (nav *nav) load(path string) *dir { d, ok := nav.dirCache[path] if !ok { diff --git a/opts.go b/opts.go index 1418140..70ec758 100644 --- a/opts.go +++ b/opts.go @@ -70,7 +70,7 @@ func init() { gOpts.keys["d"] = &callExpr{"delete", nil} gOpts.keys["c"] = &callExpr{"clear", nil} gOpts.keys["p"] = &callExpr{"put", nil} - gOpts.keys[""] = &callExpr{"renew", nil} + gOpts.keys[""] = &callExpr{"reload", nil} gOpts.keys[":"] = &callExpr{"read", nil} gOpts.keys["$"] = &callExpr{"read-shell", nil} gOpts.keys["!"] = &callExpr{"read-shell-wait", nil}