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