add 'anchorfind' option to control find start

Related #68
This commit is contained in:
Gokcehan committed 2018-08-23 01:37:07 +03:00
1 parent a59a5aa712
commit 4420e41c76
7 files changed
+18 -1

No files matched your search

+3
View File
@@ -60,6 +60,9 @@ var (
}
gOptWords = []string{
"anchorfind",
"noanchorfind",
"anchorfind!",
"dircounts",
"nodircounts",
"dircounts!",
+1
View File
@@ -93,6 +93,7 @@ keybindings:
The following options can be used to customize the behavior of lf:
anchorfind boolean (default on)
dircounts boolean (default off)
dirfirst boolean (default on)
drawbox boolean (default off)
+1
View File
@@ -96,6 +96,7 @@ keybindings:
The following options can be used to customize the behavior of lf:
anchorfind boolean (default on)
dircounts boolean (default off)
dirfirst boolean (default on)
drawbox boolean (default off)
+6
View File
@@ -14,6 +14,12 @@ import (
func (e *setExpr) eval(app *app, args []string) {
switch e.opt {
case "anchorfind":
gOpts.anchorfind = true
case "noanchorfind":
gOpts.anchorfind = false
case "anchorfind!":
gOpts.anchorfind = !gOpts.anchorfind
case "dircounts":
gOpts.dircounts = true
case "nodircounts":
+1
View File
@@ -108,6 +108,7 @@ The following command line commands are provided by lf with default keybindings:
The following options can be used to customize the behavior of lf:
.PP
.EX
anchorfind boolean (default on)
dircounts boolean (default off)
dirfirst boolean (default on)
drawbox boolean (default off)
+4 -1
View File
@@ -663,7 +663,10 @@ func findMatch(name, pattern string) bool {
name = strings.ToLower(name)
}
}
return strings.HasPrefix(name, pattern)
if gOpts.anchorfind {
return strings.HasPrefix(name, pattern)
}
return strings.Contains(name, pattern)
}
func (nav *nav) findSingle() int {
+2
View File
@@ -25,6 +25,7 @@ type sortType struct {
}
var gOpts struct {
anchorfind bool
dircounts bool
drawbox bool
globsearch bool
@@ -52,6 +53,7 @@ var gOpts struct {
}
func init() {
gOpts.anchorfind = true
gOpts.dircounts = false
gOpts.drawbox = false
gOpts.globsearch = false