From 7481040c2d8a46b1f2ce9da90ce02de79dc4ef6e Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Tue, 19 Jan 2021 01:45:42 +0300 Subject: [PATCH] enable top/bottom in cmap mappings --- doc.go | 8 ++++---- docstring.go | 10 +++++----- eval.go | 6 ++++++ lf.1 | 8 ++++---- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc.go b/doc.go index 126266f0..9f649994 100644 --- a/doc.go +++ b/doc.go @@ -1075,12 +1075,12 @@ Globbing supports '*' to match any sequence, '?' to match any character, and '[. You can enable 'incsearch' option to jump to the current match at each keystroke while typing. In this mode, you can either use 'cmd-enter' to accept the search or use 'cmd-escape' to cancel the search. Alternatively, you can also map some other commands with 'cmap' to accept the search and execute the command immediately afterwards. -Possible candidates are 'up', 'down' and their variants, 'updir', and 'open' commands. +Possible candidates are 'up', 'down' and their variants, 'top', 'bottom', 'updir', and 'open' commands. For example, you can use arrow keys to finish the search with the following mappings: - cmap up - cmap down - cmap updir + cmap up + cmap down + cmap updir cmap open Finding mechanism is implemented with commands 'find' (default 'f'), 'find-back' (default 'F'), 'find-next' (default ';'), 'find-prev' (default ','). diff --git a/docstring.go b/docstring.go index 54f5c5e8..66aee68d 100644 --- a/docstring.go +++ b/docstring.go @@ -1194,12 +1194,12 @@ while typing. In this mode, you can either use 'cmd-enter' to accept the search or use 'cmd-escape' to cancel the search. Alternatively, you can also map some other commands with 'cmap' to accept the search and execute the command immediately afterwards. Possible candidates are 'up', 'down' and -their variants, 'updir', and 'open' commands. For example, you can use arrow -keys to finish the search with the following mappings: +their variants, 'top', 'bottom', 'updir', and 'open' commands. For example, +you can use arrow keys to finish the search with the following mappings: - cmap up - cmap down - cmap updir + cmap up + cmap down + cmap updir cmap open Finding mechanism is implemented with commands 'find' (default 'f'), diff --git a/eval.go b/eval.go index 1408e10d..020be463 100644 --- a/eval.go +++ b/eval.go @@ -716,10 +716,16 @@ func (e *callExpr) eval(app *app, args []string) { case "quit": app.quitChan <- struct{}{} case "top": + if app.ui.cmdPrefix != "" && app.ui.cmdPrefix != ">" { + normal(app) + } app.nav.top() app.ui.loadFile(app.nav, true) app.ui.loadFileInfo(app.nav) case "bottom": + if app.ui.cmdPrefix != "" && app.ui.cmdPrefix != ">" { + normal(app) + } app.nav.bottom() app.ui.loadFile(app.nav, true) app.ui.loadFileInfo(app.nav) diff --git a/lf.1 b/lf.1 index effa7764..8503e091 100644 --- a/lf.1 +++ b/lf.1 @@ -1210,12 +1210,12 @@ By default, lf does not assign 'delete' command to a key to protect new users. Y .SH SEARCHING FILES There are two mechanisms implemented in lf to search a file in the current directory. Searching is the traditional method to move the selection to a file matching a given pattern. Finding is an alternative way to search for a pattern possibly using fewer keystrokes. .PP -Searching mechanism is implemented with commands 'search' (default '/'), 'search-back' (default '?'), 'search-next' (default 'n'), and 'search-prev' (default 'N'). You can enable 'globsearch' option to match with a glob pattern. Globbing supports '*' to match any sequence, '?' to match any character, and '[...]' or '[^...] to match character sets or ranges. You can enable 'incsearch' option to jump to the current match at each keystroke while typing. In this mode, you can either use 'cmd-enter' to accept the search or use 'cmd-escape' to cancel the search. Alternatively, you can also map some other commands with 'cmap' to accept the search and execute the command immediately afterwards. Possible candidates are 'up', 'down' and their variants, 'updir', and 'open' commands. For example, you can use arrow keys to finish the search with the following mappings: +Searching mechanism is implemented with commands 'search' (default '/'), 'search-back' (default '?'), 'search-next' (default 'n'), and 'search-prev' (default 'N'). You can enable 'globsearch' option to match with a glob pattern. Globbing supports '*' to match any sequence, '?' to match any character, and '[...]' or '[^...] to match character sets or ranges. You can enable 'incsearch' option to jump to the current match at each keystroke while typing. In this mode, you can either use 'cmd-enter' to accept the search or use 'cmd-escape' to cancel the search. Alternatively, you can also map some other commands with 'cmap' to accept the search and execute the command immediately afterwards. Possible candidates are 'up', 'down' and their variants, 'top', 'bottom', 'updir', and 'open' commands. For example, you can use arrow keys to finish the search with the following mappings: .PP .EX - cmap up - cmap down - cmap updir + cmap up + cmap down + cmap updir cmap open .EE .PP