parent
fdf8e9d480
commit
c8202bbc7a
7
comp.go
7
comp.go
@ -44,15 +44,15 @@ var (
|
||||
}
|
||||
|
||||
gOptWords = []string{
|
||||
"dirfirst",
|
||||
"nodirfirst",
|
||||
"dirfirst!",
|
||||
"hidden",
|
||||
"nohidden",
|
||||
"hidden!",
|
||||
"preview",
|
||||
"nopreview",
|
||||
"preview!",
|
||||
"dirfirst",
|
||||
"nodirfirst",
|
||||
"dirfirst!",
|
||||
"scrolloff",
|
||||
"tabstop",
|
||||
"ifs",
|
||||
@ -60,6 +60,7 @@ var (
|
||||
"shell",
|
||||
"showinfo",
|
||||
"sortby",
|
||||
"timefmt",
|
||||
"ratios",
|
||||
}
|
||||
)
|
||||
|
3
doc.go
3
doc.go
@ -45,9 +45,9 @@ The following commands are provided by lf without default keybindings.
|
||||
|
||||
The following options can be used to customize the behavior of lf.
|
||||
|
||||
dirfirst bool (default on)
|
||||
hidden bool (default off)
|
||||
preview bool (default on)
|
||||
dirfirst bool (default on)
|
||||
scrolloff int (default 0)
|
||||
tabstop int (default 8)
|
||||
ifs string (default "") (not exported if empty)
|
||||
@ -55,6 +55,7 @@ The following options can be used to customize the behavior of lf.
|
||||
shell string (default "$SHELL")
|
||||
showinfo string (default "none")
|
||||
sortby string (default "name")
|
||||
timefmt string (default "Mon Jan _2 15:04:05 2006")
|
||||
ratios string (default "1:2:3")
|
||||
|
||||
The following variables are exported for shell commands.
|
||||
|
@ -49,9 +49,9 @@ The following commands are provided by lf without default keybindings.
|
||||
|
||||
The following options can be used to customize the behavior of lf.
|
||||
|
||||
dirfirst bool (default on)
|
||||
hidden bool (default off)
|
||||
preview bool (default on)
|
||||
dirfirst bool (default on)
|
||||
scrolloff int (default 0)
|
||||
tabstop int (default 8)
|
||||
ifs string (default "") (not exported if empty)
|
||||
@ -59,6 +59,7 @@ The following options can be used to customize the behavior of lf.
|
||||
shell string (default "$SHELL")
|
||||
showinfo string (default "none")
|
||||
sortby string (default "name")
|
||||
timefmt string (default "Mon Jan _2 15:04:05 2006")
|
||||
ratios string (default "1:2:3")
|
||||
|
||||
The following variables are exported for shell commands.
|
||||
|
20
eval.go
20
eval.go
@ -11,6 +11,15 @@ import (
|
||||
|
||||
func (e *SetExpr) eval(app *App, args []string) {
|
||||
switch e.opt {
|
||||
case "dirfirst":
|
||||
gOpts.dirfirst = true
|
||||
app.nav.renew(app.nav.height)
|
||||
case "nodirfirst":
|
||||
gOpts.dirfirst = false
|
||||
app.nav.renew(app.nav.height)
|
||||
case "dirfirst!":
|
||||
gOpts.dirfirst = !gOpts.dirfirst
|
||||
app.nav.renew(app.nav.height)
|
||||
case "hidden":
|
||||
gOpts.hidden = true
|
||||
app.nav.renew(app.nav.height)
|
||||
@ -26,15 +35,6 @@ func (e *SetExpr) eval(app *App, args []string) {
|
||||
gOpts.preview = false
|
||||
case "preview!":
|
||||
gOpts.preview = !gOpts.preview
|
||||
case "dirfirst":
|
||||
gOpts.dirfirst = true
|
||||
app.nav.renew(app.nav.height)
|
||||
case "nodirfirst":
|
||||
gOpts.dirfirst = false
|
||||
app.nav.renew(app.nav.height)
|
||||
case "dirfirst!":
|
||||
gOpts.dirfirst = !gOpts.dirfirst
|
||||
app.nav.renew(app.nav.height)
|
||||
case "scrolloff":
|
||||
n, err := strconv.Atoi(e.val)
|
||||
if err != nil {
|
||||
@ -92,6 +92,8 @@ func (e *SetExpr) eval(app *App, args []string) {
|
||||
}
|
||||
gOpts.sortby = e.val
|
||||
app.nav.renew(app.nav.height)
|
||||
case "timefmt":
|
||||
gOpts.timefmt = e.val
|
||||
case "ratios":
|
||||
toks := strings.Split(e.val, ":")
|
||||
var rats []int
|
||||
|
8
opts.go
8
opts.go
@ -1,6 +1,9 @@
|
||||
package main
|
||||
|
||||
import "time"
|
||||
|
||||
var gOpts struct {
|
||||
dirfirst bool
|
||||
hidden bool
|
||||
preview bool
|
||||
scrolloff int
|
||||
@ -10,13 +13,14 @@ var gOpts struct {
|
||||
shell string
|
||||
showinfo string
|
||||
sortby string
|
||||
dirfirst bool
|
||||
timefmt string
|
||||
ratios []int
|
||||
keys map[string]Expr
|
||||
cmds map[string]Expr
|
||||
}
|
||||
|
||||
func init() {
|
||||
gOpts.dirfirst = true
|
||||
gOpts.hidden = false
|
||||
gOpts.preview = true
|
||||
gOpts.scrolloff = 0
|
||||
@ -24,7 +28,7 @@ func init() {
|
||||
gOpts.shell = envShell
|
||||
gOpts.showinfo = "none"
|
||||
gOpts.sortby = "name"
|
||||
gOpts.dirfirst = true
|
||||
gOpts.timefmt = time.ANSIC
|
||||
gOpts.ratios = []int{1, 2, 3}
|
||||
|
||||
gOpts.keys = make(map[string]Expr)
|
||||
|
3
ui.go
3
ui.go
@ -13,7 +13,6 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/tabwriter"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/nsf/termbox-go"
|
||||
@ -405,7 +404,7 @@ func (ui *UI) loadFile(nav *Nav) {
|
||||
return
|
||||
}
|
||||
|
||||
ui.message = fmt.Sprintf("%v %v %v", curr.Mode(), humanize(curr.Size()), curr.ModTime().Format(time.ANSIC))
|
||||
ui.message = fmt.Sprintf("%v %v %v", curr.Mode(), humanize(curr.Size()), curr.ModTime().Format(gOpts.timefmt))
|
||||
|
||||
if !gOpts.preview {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user