add default environmental variables
This commit is contained in:
1 parent
96f35e986d
commit
5787ecd1bd
5 files changed
+59
-36
No files matched your search
@@ -163,6 +163,11 @@ func (app *app) exportVars() {
|
||||
}
|
||||
|
||||
os.Setenv("id", strconv.Itoa(gClientID))
|
||||
|
||||
os.Setenv("OPENER", envOpener)
|
||||
os.Setenv("EDITOR", envEditor)
|
||||
os.Setenv("PAGER", envPager)
|
||||
os.Setenv("SHELL", envShell)
|
||||
}
|
||||
|
||||
func waitKey() error {
|
||||
|
||||
@@ -114,6 +114,15 @@ The following variables are exported for shell commands:
|
||||
$fx current file or marked file(s) if any
|
||||
$id id number of the client
|
||||
|
||||
The following default values are set to the environmental variables on unix
|
||||
when they are not set or empty:
|
||||
|
||||
$OPENER open # macos
|
||||
$OPENER xdg-open # others
|
||||
$EDITOR vi
|
||||
$PAGER less
|
||||
$SHELL sh
|
||||
|
||||
The following additional keybindings are provided by default:
|
||||
|
||||
map zh set hidden!
|
||||
@@ -129,9 +138,9 @@ The following additional keybindings are provided by default:
|
||||
|
||||
The following keybindings to applications are provided by default on unix:
|
||||
|
||||
map e $$EDITOR $f ('vi' if empty)
|
||||
map i $$PAGER $f ('less' if empty)
|
||||
map w $$SHELL ('sh' if empty)
|
||||
map e $$EDITOR "$f"
|
||||
map i $$PAGER "$f"
|
||||
map w $$SHELL
|
||||
|
||||
The following keybindings to applications are provided by default on windows:
|
||||
|
||||
@@ -525,9 +534,8 @@ You may want to use either file extensions or mime types from 'file' command:
|
||||
|
||||
Following commands are provided by default:
|
||||
|
||||
cmd open &start %f% # windows
|
||||
cmd open &open "$f" # macos
|
||||
cmd open &xdg-open "$f" # others
|
||||
cmd open &$OPENER "$f # unix
|
||||
cmd open &start %f% # windows
|
||||
|
||||
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
|
||||
|
||||
+14
-6
@@ -118,6 +118,15 @@ The following variables are exported for shell commands:
|
||||
$fx current file or marked file(s) if any
|
||||
$id id number of the client
|
||||
|
||||
The following default values are set to the environmental variables on unix
|
||||
when they are not set or empty:
|
||||
|
||||
$OPENER open # macos
|
||||
$OPENER xdg-open # others
|
||||
$EDITOR vi
|
||||
$PAGER less
|
||||
$SHELL sh
|
||||
|
||||
The following additional keybindings are provided by default:
|
||||
|
||||
map zh set hidden!
|
||||
@@ -133,9 +142,9 @@ The following additional keybindings are provided by default:
|
||||
|
||||
The following keybindings to applications are provided by default on unix:
|
||||
|
||||
map e $$EDITOR $f ('vi' if empty)
|
||||
map i $$PAGER $f ('less' if empty)
|
||||
map w $$SHELL ('sh' if empty)
|
||||
map e $$EDITOR "$f"
|
||||
map i $$PAGER "$f"
|
||||
map w $$SHELL
|
||||
|
||||
The following keybindings to applications are provided by default on
|
||||
windows:
|
||||
@@ -552,9 +561,8 @@ command:
|
||||
|
||||
Following commands are provided by default:
|
||||
|
||||
cmd open &start %f% # windows
|
||||
cmd open &open "$f" # macos
|
||||
cmd open &xdg-open "$f" # others
|
||||
cmd open &$OPENER "$f # unix
|
||||
cmd open &start %f% # windows
|
||||
|
||||
You may also use any other existing file openers as you like. Possible
|
||||
options are 'libfile-mimeinfo-perl' (executable name is 'mimeopen'), 'rifle'
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
envOpener = os.Getenv("OPENER")
|
||||
envEditor = os.Getenv("EDITOR")
|
||||
envPager = os.Getenv("PAGER")
|
||||
envShell = os.Getenv("SHELL")
|
||||
@@ -30,6 +31,26 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
if envOpener == "" {
|
||||
if runtime.GOOS == "darwin" {
|
||||
envOpener = "open"
|
||||
} else {
|
||||
envOpener = "xdg-open"
|
||||
}
|
||||
}
|
||||
|
||||
if envEditor == "" {
|
||||
envEditor = "vi"
|
||||
}
|
||||
|
||||
if envPager == "" {
|
||||
envPager = "less"
|
||||
}
|
||||
|
||||
if envShell == "" {
|
||||
envShell = "sh"
|
||||
}
|
||||
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
log.Printf("user: %s", err)
|
||||
@@ -99,29 +120,10 @@ func pasteCommand(list []string, dir *dir, cp bool) *exec.Cmd {
|
||||
}
|
||||
|
||||
func setDefaults() {
|
||||
if envEditor == "" {
|
||||
gOpts.keys["e"] = &execExpr{"$", `vi "$f"`}
|
||||
} else {
|
||||
gOpts.keys["e"] = &execExpr{"$", envEditor + ` "$f"`}
|
||||
}
|
||||
|
||||
if envPager == "" {
|
||||
gOpts.keys["i"] = &execExpr{"$", `less "$f"`}
|
||||
} else {
|
||||
gOpts.keys["i"] = &execExpr{"$", envPager + ` "$f"`}
|
||||
}
|
||||
|
||||
if envShell == "" {
|
||||
gOpts.keys["w"] = &execExpr{"$", "sh"}
|
||||
} else {
|
||||
gOpts.keys["w"] = &execExpr{"$", envShell}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
gOpts.cmds["open"] = &execExpr{"&", `open "$f"`}
|
||||
} else {
|
||||
gOpts.cmds["open"] = &execExpr{"&", `xdg-open "$f"`}
|
||||
}
|
||||
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) {
|
||||
|
||||
+1
-1
@@ -76,10 +76,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{"&", `start %f%`}
|
||||
}
|
||||
|
||||
func moveCursor(y, x int) {
|
||||
|
||||
Reference in new issue
Block a user