2016-08-13 12:49:04 +00:00
|
|
|
package main
|
|
|
|
|
2016-11-21 20:13:33 +00:00
|
|
|
import "time"
|
|
|
|
|
2016-10-01 22:14:55 +00:00
|
|
|
var gOpts struct {
|
2016-11-21 20:13:33 +00:00
|
|
|
dirfirst bool
|
2016-08-13 12:49:04 +00:00
|
|
|
hidden bool
|
|
|
|
preview bool
|
|
|
|
scrolloff int
|
|
|
|
tabstop int
|
2016-12-24 13:06:44 +00:00
|
|
|
filesep string
|
2016-08-13 12:49:04 +00:00
|
|
|
ifs string
|
2016-08-28 12:04:57 +00:00
|
|
|
previewer string
|
2016-08-27 11:12:03 +00:00
|
|
|
shell string
|
2016-08-13 12:49:04 +00:00
|
|
|
showinfo string
|
|
|
|
sortby string
|
2016-11-21 20:13:33 +00:00
|
|
|
timefmt string
|
2016-08-13 12:49:04 +00:00
|
|
|
ratios []int
|
2016-12-17 21:47:37 +00:00
|
|
|
keys map[string]expr
|
|
|
|
cmds map[string]expr
|
2016-08-13 12:49:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func init() {
|
2016-11-21 20:13:33 +00:00
|
|
|
gOpts.dirfirst = true
|
2016-08-13 12:49:04 +00:00
|
|
|
gOpts.hidden = false
|
|
|
|
gOpts.preview = true
|
|
|
|
gOpts.scrolloff = 0
|
|
|
|
gOpts.tabstop = 8
|
2016-12-24 13:06:44 +00:00
|
|
|
gOpts.filesep = ":"
|
2016-08-27 11:12:03 +00:00
|
|
|
gOpts.shell = envShell
|
2016-08-13 12:49:04 +00:00
|
|
|
gOpts.showinfo = "none"
|
2016-12-02 21:45:04 +00:00
|
|
|
gOpts.sortby = "natural"
|
2016-11-21 20:13:33 +00:00
|
|
|
gOpts.timefmt = time.ANSIC
|
2016-08-13 12:49:04 +00:00
|
|
|
gOpts.ratios = []int{1, 2, 3}
|
|
|
|
|
2016-12-17 21:47:37 +00:00
|
|
|
gOpts.keys = make(map[string]expr)
|
2016-08-13 12:49:04 +00:00
|
|
|
|
2016-12-17 21:47:37 +00:00
|
|
|
gOpts.keys["k"] = &callExpr{"up", nil}
|
|
|
|
gOpts.keys["<up>"] = &callExpr{"up", nil}
|
|
|
|
gOpts.keys["<c-u>"] = &callExpr{"half-up", nil}
|
|
|
|
gOpts.keys["<c-b>"] = &callExpr{"page-up", nil}
|
|
|
|
gOpts.keys["j"] = &callExpr{"down", nil}
|
|
|
|
gOpts.keys["<down>"] = &callExpr{"down", nil}
|
|
|
|
gOpts.keys["<c-d>"] = &callExpr{"half-down", nil}
|
|
|
|
gOpts.keys["<c-f>"] = &callExpr{"page-down", nil}
|
|
|
|
gOpts.keys["h"] = &callExpr{"updir", nil}
|
|
|
|
gOpts.keys["<left>"] = &callExpr{"updir", nil}
|
|
|
|
gOpts.keys["l"] = &callExpr{"open", nil}
|
|
|
|
gOpts.keys["<right>"] = &callExpr{"open", nil}
|
|
|
|
gOpts.keys["q"] = &callExpr{"quit", nil}
|
|
|
|
gOpts.keys["G"] = &callExpr{"bot", nil}
|
|
|
|
gOpts.keys["gg"] = &callExpr{"top", nil}
|
|
|
|
gOpts.keys[":"] = &callExpr{"read", nil}
|
|
|
|
gOpts.keys["$"] = &callExpr{"read-shell", nil}
|
|
|
|
gOpts.keys["!"] = &callExpr{"read-shell-wait", nil}
|
|
|
|
gOpts.keys["&"] = &callExpr{"read-shell-async", nil}
|
|
|
|
gOpts.keys["/"] = &callExpr{"search", nil}
|
|
|
|
gOpts.keys["?"] = &callExpr{"search-back", nil}
|
2016-12-23 15:58:24 +00:00
|
|
|
gOpts.keys["n"] = &callExpr{"search-next", nil}
|
|
|
|
gOpts.keys["N"] = &callExpr{"search-prev", nil}
|
2016-12-17 21:47:37 +00:00
|
|
|
gOpts.keys["<space>"] = &callExpr{"toggle", nil}
|
|
|
|
gOpts.keys["v"] = &callExpr{"invert", nil}
|
|
|
|
gOpts.keys["y"] = &callExpr{"yank", nil}
|
|
|
|
gOpts.keys["d"] = &callExpr{"delete", nil}
|
2016-12-19 18:53:47 +00:00
|
|
|
gOpts.keys["c"] = &callExpr{"clear", nil}
|
2016-12-17 21:47:37 +00:00
|
|
|
gOpts.keys["p"] = &callExpr{"put", nil}
|
|
|
|
gOpts.keys["<c-l>"] = &callExpr{"renew", nil}
|
2016-08-13 12:49:04 +00:00
|
|
|
|
2016-12-17 21:47:37 +00:00
|
|
|
gOpts.cmds = make(map[string]expr)
|
2016-08-13 12:49:04 +00:00
|
|
|
}
|