-
Notifications
You must be signed in to change notification settings - Fork 406
Closed
Labels
Description
Issue
Vimtex currently treats \section{...}, \subsection{...}, and \subsubsection{..} commands inside the comment environment as if they were real sections in at least these ways (I may have missed others):
- It folds them as (sub)sections.
- It lists them in the table of contents (
vimtex-toc). - It navigates to them with
[[,]],[], and][in normal mode. - It selects up to such commands with the
aPandiPtext objects.
To reproduce, open the following with vim:
\documentclass{article}
\usepackage{comment}
\begin{document}
\section{Real section}
\begin{comment}
\section{Commented section}
\subsection{Commented subsection}
\subsubsection{Commented subsubsection}
\end{comment}
\end{document}with .vimrc
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()
let g:vimtex_fold_enabled=1Proposed Solution
I think that it would be better to disregard commented (sub)section commands, since they are not part of the structure of the document. That would mean:
- They are not folded as (sub)sections.
- They are not listed in
vimtex-toc, and don't affect the (sub)section count. [[,]],[], and][skips over them.- Similarly,
iPandaPskips over them.
Personally, I like the ability to comment out entire sections, and this would help me do that without messing up document navigation.
By the way, thanks for all your work on vimtex, it's much appreciated!
Edit: For clarity, and I've also added some more features that are affected by this.