use env vars on windows
This commit is contained in:
1 parent
b8523c3258
commit
fef99c1d70
3 files changed
+53
-29
No files matched your search
@@ -123,6 +123,14 @@ when they are not set or empty:
|
||||
$PAGER less
|
||||
$SHELL sh
|
||||
|
||||
The following default values are set to the environmental variables on windows
|
||||
when they are not set or empty:
|
||||
|
||||
%OPENER% start
|
||||
%EDITOR% notepad
|
||||
%PAGER% more
|
||||
%SHELL% cmd
|
||||
|
||||
The following additional keybindings are provided by default:
|
||||
|
||||
map zh set hidden!
|
||||
@@ -136,18 +144,12 @@ The following additional keybindings are provided by default:
|
||||
map st :set sortby time; set info time
|
||||
map gh cd ~
|
||||
|
||||
The following keybindings to applications are provided by default on unix:
|
||||
The following keybindings to applications are provided by default:
|
||||
|
||||
map e $$EDITOR "$f"
|
||||
map i $$PAGER "$f"
|
||||
map e $$EDITOR $f
|
||||
map i $$PAGER $f
|
||||
map w $$SHELL
|
||||
|
||||
The following keybindings to applications are provided by default on windows:
|
||||
|
||||
map e $notepad %f%
|
||||
map i $more %f%
|
||||
map w $cmd
|
||||
|
||||
Configuration
|
||||
|
||||
Configuration files should be located at:
|
||||
@@ -532,10 +534,9 @@ You may want to use either file extensions or mime types from 'file' command:
|
||||
esac
|
||||
}}
|
||||
|
||||
Following commands are provided by default:
|
||||
Following command is provided by default:
|
||||
|
||||
cmd open &$OPENER "$f # unix
|
||||
cmd open &start %f% # windows
|
||||
cmd open &$OPENER $f
|
||||
|
||||
You may also use any other existing file openers as you like. Possible options
|
||||
are 'libfile-mimeinfo-perl' (executable name is 'mimeopen'), 'rifle' (ranger's
|
||||
|
||||
+13
-13
@@ -127,6 +127,14 @@ when they are not set or empty:
|
||||
$PAGER less
|
||||
$SHELL sh
|
||||
|
||||
The following default values are set to the environmental variables on windows
|
||||
when they are not set or empty:
|
||||
|
||||
%OPENER% start
|
||||
%EDITOR% notepad
|
||||
%PAGER% more
|
||||
%SHELL% cmd
|
||||
|
||||
The following additional keybindings are provided by default:
|
||||
|
||||
map zh set hidden!
|
||||
@@ -140,19 +148,12 @@ The following additional keybindings are provided by default:
|
||||
map st :set sortby time; set info time
|
||||
map gh cd ~
|
||||
|
||||
The following keybindings to applications are provided by default on unix:
|
||||
The following keybindings to applications are provided by default:
|
||||
|
||||
map e $$EDITOR "$f"
|
||||
map i $$PAGER "$f"
|
||||
map e $$EDITOR $f
|
||||
map i $$PAGER $f
|
||||
map w $$SHELL
|
||||
|
||||
The following keybindings to applications are provided by default on
|
||||
windows:
|
||||
|
||||
map e $notepad %f%
|
||||
map i $more %f%
|
||||
map w $cmd
|
||||
|
||||
|
||||
Configuration
|
||||
|
||||
@@ -559,10 +560,9 @@ command:
|
||||
esac
|
||||
}}
|
||||
|
||||
Following commands are provided by default:
|
||||
Following command is provided by default:
|
||||
|
||||
cmd open &$OPENER "$f # unix
|
||||
cmd open &start %f% # windows
|
||||
cmd open &$OPENER $f
|
||||
|
||||
You may also use any other existing file openers as you like. Possible
|
||||
options are 'libfile-mimeinfo-perl' (executable name is 'mimeopen'), 'rifle'
|
||||
|
||||
+27
-4
@@ -9,6 +9,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
envOpener = os.Getenv("OPENER")
|
||||
envEditor = os.Getenv("EDITOR")
|
||||
envPager = os.Getenv("PAGER")
|
||||
envShell = os.Getenv("SHELL")
|
||||
)
|
||||
|
||||
var (
|
||||
gDefaultShell = "cmd"
|
||||
gDefaultSocketProt = "tcp"
|
||||
@@ -21,6 +28,22 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
if envOpener == "" {
|
||||
envOpener = "start"
|
||||
}
|
||||
|
||||
if envEditor == "" {
|
||||
envEditor = "notepad"
|
||||
}
|
||||
|
||||
if envPager == "" {
|
||||
envPager = "more"
|
||||
}
|
||||
|
||||
if envShell == "" {
|
||||
envShell = "cmd"
|
||||
}
|
||||
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
log.Printf("user: %s", err)
|
||||
@@ -76,10 +99,10 @@ func pasteCommand(list []string, dir *dir, cp bool) *exec.Cmd {
|
||||
}
|
||||
|
||||
func setDefaults() {
|
||||
gOpts.cmds["open"] = &execExpr{"&", `start %f%`}
|
||||
gOpts.keys["e"] = &execExpr{"$", `notepad %f%`}
|
||||
gOpts.keys["i"] = &execExpr{"$", `more %f%`}
|
||||
gOpts.keys["w"] = &execExpr{"$", "cmd"}
|
||||
gOpts.cmds["open"] = &execExpr{"&", "%OPENER% %f%"}
|
||||
gOpts.keys["e"] = &execExpr{"$", "%EDITOR% %f%"}
|
||||
gOpts.keys["i"] = &execExpr{"!", "%PAGER% %f%"}
|
||||
gOpts.keys["w"] = &execExpr{"$", "%SHELL%"}
|
||||
}
|
||||
|
||||
func moveCursor(y, x int) {
|
||||
|
||||
Reference in new issue
Block a user