-
Notifications
You must be signed in to change notification settings - Fork 3
g
and gi
commands search text from files returned by lf or lfi
- g [ text pattern ] [ params for lf ... ]
- The 1st parameter [text pattern] is
Basic Regular Expression
(which is used by the regulargrep
command by default) pattern. - All parameters except the 1st parameter obey the rule of lf command
- g
- Will show help message
Basically, g
and gi
commands have the same quirks that lf
command has because it is invoked behind the scene;
See lf or lfi for more details
$ cat Documents/test/tmp.txt
Java
JavaScript
$ g [Jj]ava$ . Docu .txt
Documents/text/tmp.txt:1:Java
$ g
... help message ...
g
command invokes grep -n
by default
You can override this default setting by defining _LIST_FILE_GREP_OPTIONS
environment variable
For example, you can do as follows to make g
accept Extended Regular Expression
pattern
$ _LIST_FILE_GREP_OPTIONS="-E -n"
Unset _LIST_FILE_GREP_OPTIONS
as follows to restore the default setting
$ unset _LIST_FILE_GREP_OPTIONS
Notice that making _LIST_FILE_GREP_OPTIONS
empty as follows will have a complete different effect;
( It wont't provide any parameter for grep
unlike the default setting which is grep -n
)
$ _LIST_FILE_GREP_OPTIONS=
Also notice that g
ignores GREP_OPTIONS
variable so setting GREP_OPTIONS
for other applications doesn't affect behavior of g
( See man page for grep
about GREP_OPTIONS
)