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