diff --git a/app.go b/app.go index 8219aa6b..13e636dc 100644 --- a/app.go +++ b/app.go @@ -549,6 +549,7 @@ func (app *app) runShell(s string, args []string, prefix string) { app.nav.exportFiles() app.ui.exportSizes() app.ui.exportMode() + exportLfPath() exportOpts() gState.mutex.Lock() diff --git a/etc/lfrc.ps1.example b/etc/lfrc.ps1.example index 41a57513..2e4b7017 100644 --- a/etc/lfrc.ps1.example +++ b/etc/lfrc.ps1.example @@ -21,33 +21,8 @@ cmd open &&$Env:OPENER.Trim('"', ' ') "$Env:f" map e $&$Env:EDITOR "$Env:f" map i !&$Env:PAGER "$Env:f" map w $&$Env:SHELL -cmd doc !&$Env:lf.Trim('"', ' ') -doc | &$Env:PAGER +cmd doc !&$Env:lf -doc | &$Env:PAGER map doc -cmd maps !&$Env:lf.Trim('"', ' ') -remote "query $Env:id maps" | &$Env:PAGER -cmd cmaps !&$Env:lf.Trim('"', ' ') -remote "query $Env:id cmaps" | &$Env:PAGER -cmd cmds !&$Env:lf.Trim('"', ' ') -remote "query $Env:id cmds" | &$Env:PAGER - -# change the editor used in default editor keybinding -# There is no builtin terminal editor installed in Windows. The default editor -# mapping uses 'notepad' which launches in a separate GUI window. You may -# instead install a terminal editor of your choice and replace the default -# editor keybinding accordingly. -map e $vim $Env:f - -# change the pager used in default pager keybinding -# The standard pager used in Windows is 'more' which is not a very capable -# pager. You may instead install a pager of your choice and replace the default -# pager keybinding accordingly. -map i $less $Env:f - -# change the shell used in default shell keybinding -map w $powershell - -# change 'doc' command to use a different pager -cmd doc $lf -doc | less - -# leave some space at the top and the bottom of the screen -set scrolloff 10 - -# use enter for shell commands -map shell +cmd maps !&$Env:lf -remote "query $Env:id maps" | &$Env:PAGER +cmd cmaps !&$Env:lf -remote "query $Env:id cmaps" | &$Env:PAGER +cmd cmds !&$Env:lf -remote "query $Env:id cmds" | &$Env:PAGER diff --git a/main.go b/main.go index febd5350..af94141d 100644 --- a/main.go +++ b/main.go @@ -87,13 +87,6 @@ func exportEnvVars() { level++ os.Setenv("LF_LEVEL", strconv.Itoa(level)) - - lfPath, err := os.Executable() - if err != nil { - log.Printf("getting path to lf binary: %s", err) - lfPath = "lf" - } - os.Setenv("lf", quoteString(lfPath)) } // used by exportOpts below @@ -150,6 +143,15 @@ func getOptsMap() map[string]string { return opts } +func exportLfPath() { + lfPath, err := os.Executable() + if err != nil { + log.Printf("getting path to lf binary: %s", err) + lfPath = "lf" + } + os.Setenv("lf", quoteString(lfPath)) +} + func exportOpts() { for key, value := range getOptsMap() { os.Setenv(key, value)