4

maybe I'm drastically overlooking something trivial, but is there any possibility in Vim (with LaTeX-suite) to view the table of contents?

To be more precisely, I'm looking for something equivalent to emacs'/AucTeX' C-c =, which displays a nice readable table of contents in a separate buffer.

phimuemue
  • 34,669
  • 9
  • 84
  • 115

1 Answers1

3

maybe use:

:let @a=''
:g/\\\(part\|chapter\|section\|subsection\|subsubsection\|paragraph\|subparagraph\)\>/y A
:winc n
:put a

maybe have a function to do that and map whatever you like to that.

Benoit
  • 76,634
  • 23
  • 210
  • 236
  • 2
    Now can you make that nested and linkable ;-) – puk Feb 17 '12 at 09:46
  • @Benoit Could you please explain `\>/y`? I get the `g`: global search for ``\\`` (literal backslash) + ``\(`` (annoying vim syntax for non-literal parenthesis to get a group) and so forth. Then you save that as `A`, yet later call `put a`? Is this case-insensitive? What am I missing here? – Jonathan Komar Sep 06 '17 at 07:15
  • `\>` is part of the pattern and ensures there is no other word character afterwords (equivalent to `\b` in some regexp engines). `/` is the pattern delimiter, therefore it ends the pattern. `y A` is a command that yanks the line into register a, in append mode (see https://stackoverflow.com/questions/3997078/how-to-paste-yanked-text-into-vim-command-line/3997110#3997110 if you need to read about registers). – Benoit Sep 08 '17 at 14:14