Thank you for the answer. I am new to mailing list, so I hope it is correct that I am sending this reply to Gavin Smith and CCing it to [email protected]
> On 05 Nov 2016, at 21:52, Gavin Smith <[email protected]> wrote: > > There is alreadyhttp://www.vim.org/scripts/script.php?script_id=21 > (although I've never used it so can't say how well it works). Huh, didn’t know about that, but from the looks of it it isn’t exactly what I am looking to implement and I can see already some bugs, but it will be handy as a secondary source. > This command can do various things. To be on the safe side, > > info --file bash --node introduction --output - 2>/dev/null > > is better. Noted. It didn’t work on the Texinfo that comes with my system, so I had to install the current version from the package manager. > References contain the node name. For example, in (bash)Definitions, there is > > A `control operator' or a `redirection operator'. *Note > Redirections::, for a list of redirection operators. Operators > contain at least one unquoted `metacharacter'. > > To get the node "Redirections" the cross-reference refers to, you can do > > info --file bash --node Redirections OK, I should have known that. > I don't think there is an (easy) way to do this from the command-line. > There is the "I" command from within Info which gives you a menu of > matching index entries, but as far as I know, there isn't a way to get > this from the command line. (For example, run "info bash" followed by > "Ifor", followed by Return.) Would that be useful? No, that’s the problem. My idea is to have to plugin work like this: Vim is just the frontend that displays the node and info is the backend that actually understands the info file. The user would type a command like `:Index foo bar baz` and Vim would format that into something info could understand, send it to info, info does its thing and returns a list of locations, Vim parses those and presents them to the user (e.g. in the location list of the current buffer). That’s kind of how the `:grep` command works im Vim as well: Vim calls grep with some arguments, grep does its thing and prints the locations to its standard output, Vim reads that, formats it for the user and displays the results in the location list buffer. So the missing part is some “grep-like” search. The closes thing I can think of would be to print the entire file and pipe it into a filter: > info bash 2>/dev/null | grep —line-number shell Of course grep is unsuitable for the job because it would just search the entire file for that word. I might be able to get it to work if there was a way of printing the index to standard output. How does info know what qualifies as an index? If I could I could then turn a term like `for` into `* for:` and grep for that. However, that’s very hacky. Wouldn’t it be better to have such a feature built info info instead? It would not only be useful for me but for people who might want to use info from other programs as well. Is this the place to discuss such an issue or should I post on another mailing list? > The node names and line numbers are present in the "virtual index", so > it should be sufficient for your needs. Any way of accessing this virtual index? > Also, I think you misunderstand the structure of an Info file. Nodes > are not nested within one another, so your location would just be > > info://file-name/node-2/ I see. The version of info that came with my system (4.8) required me to go from node to node as if they were nested, but 6.3 doesn’t.
