From 46cc577d4a815f959492ff2233630a63716aa613 Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Sat, 26 Jul 2025 21:42:52 +1000 Subject: [PATCH] Cleanup (#2065) --- complete.go | 8 ++++---- eval.go | 26 ++++++++++++++------------ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/complete.go b/complete.go index a60aea5e..305d59d2 100644 --- a/complete.go +++ b/complete.go @@ -348,10 +348,10 @@ func completeCmd(acc []rune) (matches []string, longestAcc []rune) { case "selmode": matches, longest = matchWord(f[2], []string{"all", "dir"}) case "sortby": - matches, longest = matchWord(f[2], []string{"natural", "name", "size", "time", "atime", "btime", "ctime", "ext", "custom"}) + matches, longest = matchWord(f[2], []string{"atime", "btime", "ctime", "custom", "ext", "name", "natural", "size", "time"}) default: if slices.Contains(gOptWords, f[1]+"!") { - matches, longest = matchWord(f[2], []string{"true", "false"}) + matches, longest = matchWord(f[2], []string{"false", "true"}) } } case "setlocal": @@ -368,10 +368,10 @@ func completeCmd(acc []rune) (matches []string, longestAcc []rune) { } switch f[2] { case "sortby": - matches, longest = matchWord(f[3], []string{"natural", "name", "size", "time", "atime", "btime", "ctime", "ext", "custom"}) + matches, longest = matchWord(f[3], []string{"atime", "btime", "ctime", "custom", "ext", "name", "natural", "size", "time"}) default: if slices.Contains(gLocalOptWords, f[2]+"!") { - matches, longest = matchWord(f[3], []string{"true", "false"}) + matches, longest = matchWord(f[3], []string{"false", "true"}) } } case "map", "nmap", "vmap", "cmap": diff --git a/eval.go b/eval.go index ce802f00..6e99b74a 100644 --- a/eval.go +++ b/eval.go @@ -98,20 +98,10 @@ func (e *setExpr) eval(app *app, args []string) { } app.ui.loadFile(app, true) } - case "filtermethod": - switch e.val { - case "text", "glob", "regex": - gOpts.filtermethod = searchMethod(e.val) - default: - app.ui.echoerr("filtermethod: value should either be 'text', 'glob' or 'regex") - return - } - app.nav.sort() - app.nav.position() - app.ui.sort() - app.ui.loadFile(app, true) + // DEPRECATED: remove after r37 is released case "globfilter", "noglobfilter", "globfilter!": app.ui.echoerr("option 'globfilter' is deprecated, use 'filtermethod' instead") + // DEPRECATED: remove after r37 is released case "globsearch", "noglobsearch", "globsearch!": app.ui.echoerr("option 'globsearch' is deprecated, use 'searchmethod' instead") case "hidden", "nohidden", "hidden!": @@ -239,6 +229,18 @@ func (e *setExpr) eval(app *app, args []string) { gOpts.errorfmt = e.val case "filesep": gOpts.filesep = e.val + case "filtermethod": + switch e.val { + case "text", "glob", "regex": + gOpts.filtermethod = searchMethod(e.val) + default: + app.ui.echoerr("filtermethod: value should either be 'text', 'glob' or 'regex") + return + } + app.nav.sort() + app.nav.position() + app.ui.sort() + app.ui.loadFile(app, true) case "findlen": n, err := strconv.Atoi(e.val) if err != nil {