Thanks Tim, that actually works great. Of course, now I want more...
so if you are up for more read on.

Basically the format for a PDF reference is: "N N R" where "N" is an
integer and "R" is literal. So typically you will see something like a
PDF "Name" (which is prefixed with a "/"), then a reference to an
object reference value for that name. For example

5 0 obj
<<
/Type /Catalog
/Pages 1 0 R
/Outlines 19 0 R
/PageMode /UseOutlines
/Metadata 3 0 R
>>

...

19 0 obj
etc..


The reference "19 0 R" points to a PDF object declaration somewhere in
the file like "19 0 obj". So, right now (thanks to your help) I can
put my cursor over the "19" in the /Outlines reference value, hit F4
and navigate directly to the "19 0 obj". Now... it would be even
better if I didn't have to put the cursor on the id number itself,
just the line it's on. I suppose that would mean navigating to the
first reference ("\d+\s\d+\sR") and then executing the object search
which you just provided.

If you want an example of this sort of text, just open any PDF file in
Vim and look for "/Outlines" or "/Catalog".

BTW... just noticing that characters classes (like "\d" for digits)
don't seem to work in regular Vim "/" searches, is that really the
case?

Thanks!
Scott

On Apr 13, 12:06 pm, Tim Chase <v...@tim.thechases.com> wrote:
> On 04/13/2011 01:41 PM, Scottb wrote:
>
> > Hi all, I'm working with a lot of PDF lately and I'm looking
> > for a way to map a key combination that will allow me to
> > follow object references. Basically that would mean "look at
> > the object ref number that is under the cursor right now and
> > find a pattern like "^\s* $refnumber \d* obj" where $refnumber
> > is the value found under the cursor.
>
> While I don't have a full understanding of what you're describing
> (some actual data/text would help verify), it looks like
> something like
>
>   :nnoremap <f4> /^\s* <c-r><c-w> \d* obj"<cr>
>
> might do the trick.  The ^R^W sequence brings the Word under the
> cursor into the search.  Or you can use ^R^A if you need the WORD
> under the cursor.
>
>    :help c_CTRL-R_CTRL-W
>
> -tim

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to