Fix quoting of lf environment variable for pwsh (#1990)
* Fix quoting of `lf` environment variable for pwsh * Simplify lfrc * typo * Remove redundant/irrelevant pwsh configs
This commit is contained in:
1 parent
b25976cef7
commit
2494b3f632
3 files changed
+14
-36
No files matched your search
@@ -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()
|
||||
|
||||
+4
-29
@@ -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 <f-1> 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 <enter> 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
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user