use open-file command instead of opener option

Mentioned in #7.
This commit is contained in:
Gokcehan 2016-08-25 00:51:52 +03:00
parent b90bd273f7
commit ef4dd12e33
3 changed files with 2 additions and 13 deletions

View File

@ -21,7 +21,6 @@ var (
"scrolloff", "scrolloff",
"sortby", "sortby",
"showinfo", "showinfo",
"opener",
"ratios", "ratios",
} }
) )

12
eval.go
View File

@ -79,8 +79,6 @@ func (e *SetExpr) eval(app *App, args []string) {
} }
gOpts.sortby = e.val gOpts.sortby = e.val
app.nav.renew(app.nav.height) app.nav.renew(app.nav.height)
case "opener":
gOpts.opener = e.val
case "ratios": case "ratios":
toks := strings.Split(e.val, ":") toks := strings.Split(e.val, ":")
var rats []int var rats []int
@ -179,14 +177,8 @@ func (e *CallExpr) eval(app *App, args []string) {
return return
} }
if len(app.nav.marks) == 0 { if cmd, ok := gOpts.cmds["open-file"]; ok {
app.runShell(fmt.Sprintf("%s '%s'", gOpts.opener, path), nil, false, false) cmd.eval(app, e.args)
} else {
s := gOpts.opener
for m := range app.nav.marks {
s += fmt.Sprintf(" '%s'", m)
}
app.runShell(s, nil, false, false)
} }
case "bot": case "bot":
app.nav.bot() app.nav.bot()

View File

@ -8,7 +8,6 @@ type Opts struct {
ifs string ifs string
showinfo string showinfo string
sortby string sortby string
opener string
ratios []int ratios []int
keys map[string]Expr keys map[string]Expr
cmds map[string]Expr cmds map[string]Expr
@ -24,7 +23,6 @@ func init() {
gOpts.ifs = "" gOpts.ifs = ""
gOpts.showinfo = "none" gOpts.showinfo = "none"
gOpts.sortby = "name" gOpts.sortby = "name"
gOpts.opener = "xdg-open"
gOpts.ratios = []int{1, 2, 3} gOpts.ratios = []int{1, 2, 3}
gOpts.keys = make(map[string]Expr) gOpts.keys = make(map[string]Expr)