2

How do I jump exactly to the definition of an option within a man page?

Example: try to find what -L means when performing man curl.

Naive approach: /-L requires 5 ns (nexts) before I get to the actual definition.

A little better: /-L, requires 4 ns (nexts).

Is there any reliable way to jump exactly to the argument documentation in a man page?

2
  • some command have a proper info page (try ` info ls` , quit with CTRL-X CTRL-C) which allow more or less directe navigation, there is a drawback, you have to know how to navigate in emacs mode.
    – Archemar
    Feb 1, 2016 at 9:58
  • Viewing manuals uses your normal pager (e.g. $PAGER or /usr/bin/pager - which is normally a symlink), so you'll want to identify which pager you use. Mar 31, 2016 at 1:32

3 Answers 3

2

While I wasn't able to find any way to pass the argument into man itself, the searching mechanism (using /) when viewing a manual accepts regular expressions. I typically search for the argument by attempting to match it as the first thing on a line after spaces.

I've tested this search against your example of finding the -L argument for curl and nailed it in the first try:

/^ +-L

brief regex explanation:

^ = beginning of line

space = a literal space character

+ = one or more of the preceding character (a space in this instance)

-L = the argument you are trying to locate

1

How about trying to search for space-dash-L-comma?

As in / -L,

I don't have curl to check that particular man page, but in general all man pages are basically one big page, with differing formats. Options are usually listed at the start, but no real easy way to jump to their definitions.

Most man pages are available on the web somewhere too, a web search for the command and the option in question maybe more useful & possibly quicker too?

1
  • / -L, took 3 searches. But I think you're right, there's not easy way to directly jump to their definitions.
    – mark
    Jan 22, 2016 at 8:12
0

If you view your man pages in Emacs (M-xman), you get some navigation built-in (e.g. n and p for next/previous section, s to jump straight to SEE ALSO). It's then a small matter of writing a couple of Lisp functions to achieve what you want...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .