Vimtex: [feature] show input and include in VimtexToc

Created on 1 Aug 2016  路  17Comments  路  Source: lervag/vimtex

Is it possible to add an option to show all files included with input{} or include{} in the Toc window?
If yes you could additionally add an option to hide files which already have a link in the Toc.

E.g. I normally input{} my macros and I would like to be able to jump to them from VimtexToc, but as there is nothing which would be available in the Toc it is not possible.

All 17 comments

Add let g:vimtex_toc_show_included_files = 1 in your vimrc file, and the ToC will now have entries for each included file. Let me know if you have suggestions for improving it.

That was fast and it works well. Thank you very much!

For me its good like it is, the only idea I already mentioned in the OP is that you could add another option to only add links to included files, that don't already have an entry in the ToC.
It doesn't matter for me, I don't mind the unnecessary entries, but perhaps you like the idea.

It is doable, but if I did that, then I will instead remove the option, because in this case, I feel it should not be optional.

That is, I suggest the following:

  1. Remove the g:vimtex_toc_show_included_files option
  2. Always show included files in TOC unless they contain other TOC entries

What to you think?

I think this is the most intuitive option, I like it that way, that way everyone knows about the option without reading up on all options.

Ok, I'll implement it when I get the time, hopefully sometime later this week.

It should work now. Please test. (It seems I had more time today than expected.)

I tested just now and the included files don't show up.

Strange. They do here. Can you provide a minimal example?

yes:

main.tex

\documentclass[a4paper,12pt]{scrartcl}
\input{./tex/commands}

\begin{document}
\input{./tex/part1}
\end{document}

./tex/commands.tex

\newcommand{\tt}{test}

./tex/part1.tex

%TODO

Oh man my bad for the commands I forgot the .tex for the test.
With .tex it works. but part1 doesn't show up atm.

As I said, it works for me. See attached figure.

Perhaps the problem is related to options or something. Can you create/apply a minimal vimrc file?

screen

Okay I'll check

I perhaps found the problem. I did not post the correct minimal example accidentally.
In part1.tex I have:

%TODO
%

I did overlook the second line.
With one line (like the example I posted earlier) it is showing up in the ToC, with two it disappears. I guess it is actually the problem I pointed out in the last commit.

For every line for a file previously added it adds:

+        let l:included.toc_len_prev += 1
+        let l:included.current.entries += 1

Is this possible? ... as I said I am not a vimscript speaker ;)
(If I am correct it should only add +1 if there was a command like section{} etc., but it doesn't check for one)

Thanks, it was almost there. I think it is fixed now.

Yeah, working :+1:
Glad I could help!

Great! :)

As it is more a question then a request and fits this issue a little, I don't open a new issue.

Is it intended to omit begin{titlepage} from ToC? If not you could also add that environment.

Nope, not intended. I just never considered it. I guess it makes sense.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsbuffalo picture vsbuffalo  路  3Comments

krissen picture krissen  路  5Comments

LuxGiammi picture LuxGiammi  路  3Comments

siemdejong picture siemdejong  路  5Comments

chakravala picture chakravala  路  5Comments