diff --git a/doc.go b/doc.go index e585db7e..858de261 100644 --- a/doc.go +++ b/doc.go @@ -7,7 +7,8 @@ lf is a terminal file manager. Source code can be found in the repository at https://github.com/gokcehan/lf. This documentation can either be read from terminal using 'lf -doc' or online -at https://godoc.org/github.com/gokcehan/lf. +at https://godoc.org/github.com/gokcehan/lf. You can also use 'doc' command +(default '') inside lf to view the documentation in a pager. You can run 'lf -help' to see descriptions of command line options. diff --git a/docstring.go b/docstring.go index b4323612..10f78b09 100644 --- a/docstring.go +++ b/docstring.go @@ -9,7 +9,8 @@ Source code can be found in the repository at https://github.com/gokcehan/lf. This documentation can either be read from terminal using 'lf -doc' or -online at https://godoc.org/github.com/gokcehan/lf. +online at https://godoc.org/github.com/gokcehan/lf. You can also use 'doc' +command (default '') inside lf to view the documentation in a pager. You can run 'lf -help' to see descriptions of command line options. diff --git a/etc/lfrc.example b/etc/lfrc.example index 55dc838a..4dc23956 100644 --- a/etc/lfrc.example +++ b/etc/lfrc.example @@ -31,9 +31,6 @@ map X !$f map o &mimeopen $f map O $mimeopen --ask $f -# show documentation (overrides 'search-back' command) -map ? $lf -doc | $PAGER - # define a custom 'open' command # This command is called when current file is not a directory. You may want to # use either file extensions and/or mime types here. Below uses an editor for diff --git a/lf.1 b/lf.1 index 8efb6086..3dad5095 100644 --- a/lf.1 +++ b/lf.1 @@ -19,7 +19,7 @@ lf is a terminal file manager. .PP Source code can be found in the repository at https://github.com/gokcehan/lf. .PP -This documentation can either be read from terminal using 'lf -doc' or online at https://godoc.org/github.com/gokcehan/lf. +This documentation can either be read from terminal using 'lf -doc' or online at https://godoc.org/github.com/gokcehan/lf. You can also use 'doc' command (default '') inside lf to view the documentation in a pager. .PP You can run 'lf -help' to see descriptions of command line options. .SH REFERENCE diff --git a/os.go b/os.go index 8f9fe992..a1798a3c 100644 --- a/os.go +++ b/os.go @@ -124,6 +124,9 @@ func setDefaults() { gOpts.keys["e"] = &execExpr{"$", `$EDITOR "$f"`} gOpts.keys["i"] = &execExpr{"$", `$PAGER "$f"`} gOpts.keys["w"] = &execExpr{"$", "$SHELL"} + + gOpts.cmds["doc"] = &execExpr{"$", "lf -doc | $PAGER"} + gOpts.keys[""] = &callExpr{"doc", nil, 1} } func moveCursor(y, x int) { diff --git a/os_windows.go b/os_windows.go index bcfdc39b..420b82e9 100644 --- a/os_windows.go +++ b/os_windows.go @@ -107,6 +107,9 @@ func setDefaults() { gOpts.keys["e"] = &execExpr{"$", "%EDITOR% %f%"} gOpts.keys["i"] = &execExpr{"!", "%PAGER% %f%"} gOpts.keys["w"] = &execExpr{"$", "%SHELL%"} + + gOpts.cmds["doc"] = &execExpr{"!", "lf -doc | $PAGER"} + gOpts.keys[""] = &callExpr{"doc", nil, 1} } func moveCursor(y, x int) {