Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: go to label #853

Closed
petRUShka opened this issue May 25, 2017 · 5 comments
Closed

Feature: go to label #853

petRUShka opened this issue May 25, 2017 · 5 comments

Comments

@petRUShka
Copy link

petRUShka commented May 25, 2017

Minimal working example

\documentclass{minimal}

\usepackage{amsmath, amstext, amsfonts, amssymb, amsthm}


\begin{document}

\begin{equation}\label{eq:equation}
1 + 1 = 2
\end{equation}

...

Some text with \eqref{eq:equation}.

\end{document}

I want to place cursor on \eqref{eq:equation} press Ctrl+] and go to definition of eq:equation (e.g. to line with \label{eq:equation}).

It is very convenient and it is a VIM way of exploring any document including VIM-help.

Possibly ctags should help. There is a discussion on SoF about it and one more and blog post on subject.

P.S. Please don't focus on equations, any other labeled items (theorems and etc) should be covered and also cited items too (bibliography items).

@andymass
Copy link
Contributor

andymass commented May 25, 2017

FYI: universal CTAGS seems to work just fine in this MWE (a more maintained ctags). Type :tags filename.tex, then ctrl+] works as expected. Also, even without tags there is the built in gd goto definition family of mappings, although these don't always work.

@lervag
Copy link
Owner

lervag commented Jun 5, 2017

I am not sure I want to add anything to vimtex for this. Tags are an inherent part of Vim and should work out of the box.

There exists plugins such as gutentags for automatic generation/updating of tag files. I could add a minor entry in the docs to suggest such plugins?

Also, I could update the iskeyword option to include :. This would allow CTRL-] on eq:equation.

@petRUShka
Copy link
Author

I think proper instruction "How to enable tags" should be very useful! As well as updated iskeyword.

lervag added a commit that referenced this issue Jun 7, 2017
lervag added a commit that referenced this issue Jun 7, 2017
@lervag
Copy link
Owner

lervag commented Jun 7, 2017

Let me know what you think about the update to the docs. Perhaps one should add more info than this? I'd prefer a good reference, though, instead of writing too much in the docs.

@petRUShka
Copy link
Author

petRUShka commented Jun 7, 2017

Looks good enough. But universal-ctags seems not to support *.bib files. So it is needed additional configuration. I placed following code borrowed from that answer in ~/.ctags and it works fine:

--langdef=bib
--langmap=bib:.bib
--regex-bib=/^@[A-Za-z]+\{([^,]*)/\1/b,bib/   

Possibly it can be noticed in docs too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants