parent
ca7a3ccab4
commit
cb072eba12
3
comp.go
3
comp.go
@ -68,6 +68,9 @@ var (
|
||||
"reverse",
|
||||
"noreverse",
|
||||
"reverse!",
|
||||
"smartcase",
|
||||
"nosmartcase",
|
||||
"smartcase!",
|
||||
"wrapscan",
|
||||
"nowrapscan",
|
||||
"wrapscan!",
|
||||
|
1
doc.go
1
doc.go
@ -75,6 +75,7 @@ The following options can be used to customize the behavior of lf:
|
||||
ignorecase boolean (default off)
|
||||
preview boolean (default on)
|
||||
reverse boolean (default off)
|
||||
smartcase boolean (default off)
|
||||
wrapscan boolean (default on)
|
||||
scrolloff integer (default 0)
|
||||
tabstop integer (default 8)
|
||||
|
@ -79,6 +79,7 @@ The following options can be used to customize the behavior of lf:
|
||||
ignorecase boolean (default off)
|
||||
preview boolean (default on)
|
||||
reverse boolean (default off)
|
||||
smartcase boolean (default off)
|
||||
wrapscan boolean (default on)
|
||||
scrolloff integer (default 0)
|
||||
tabstop integer (default 8)
|
||||
|
6
eval.go
6
eval.go
@ -62,6 +62,12 @@ func (e *setExpr) eval(app *app, args []string) {
|
||||
case "reverse!":
|
||||
gOpts.reverse = !gOpts.reverse
|
||||
app.nav.renew(app.nav.height)
|
||||
case "smartcase":
|
||||
gOpts.smartcase = true
|
||||
case "nosmartcase":
|
||||
gOpts.smartcase = false
|
||||
case "smartcase!":
|
||||
gOpts.smartcase = !gOpts.smartcase
|
||||
case "wrapscan":
|
||||
gOpts.wrapscan = true
|
||||
case "nowrapscan":
|
||||
|
6
nav.go
6
nav.go
@ -370,7 +370,11 @@ func (nav *nav) cd(wd string) error {
|
||||
|
||||
func match(pattern, name string) (matched bool, err error) {
|
||||
if gOpts.ignorecase {
|
||||
pattern, name = strings.ToLower(pattern), strings.ToLower(name)
|
||||
lpattern := strings.ToLower(pattern)
|
||||
if !gOpts.smartcase || lpattern == pattern {
|
||||
pattern = lpattern
|
||||
name = strings.ToLower(name)
|
||||
}
|
||||
}
|
||||
if gOpts.globsearch {
|
||||
return filepath.Match(pattern, name)
|
||||
|
2
opts.go
2
opts.go
@ -10,6 +10,7 @@ var gOpts struct {
|
||||
ignorecase bool
|
||||
preview bool
|
||||
reverse bool
|
||||
smartcase bool
|
||||
wrapscan bool
|
||||
scrolloff int
|
||||
tabstop int
|
||||
@ -34,6 +35,7 @@ func init() {
|
||||
gOpts.ignorecase = false
|
||||
gOpts.preview = true
|
||||
gOpts.reverse = false
|
||||
gOpts.smartcase = false
|
||||
gOpts.wrapscan = true
|
||||
gOpts.scrolloff = 0
|
||||
gOpts.tabstop = 8
|
||||
|
Loading…
Reference in New Issue
Block a user