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

Support for autocompletion of commands defined through \DeclarePairedDelimiter and other "command-defining" commands like \NewDocumentCommand #2123

Closed
rionda opened this issue Aug 2, 2021 · 5 comments

Comments

@rionda
Copy link
Contributor

rionda commented Aug 2, 2021

The commands that are locally defined through \newcommand show up in the autocomplete tab from, e.g., YouCompleteMe, I assume through some magic in vimtex =).

It would be nice to also have the commands that are defined through \DeclarePairedDelimiter (I believe it is from mathtools) and \DeclareDocumentCommand and \NewDocumentCommand (from xparse) added to the list for autocompletion.

Thanks!
Matteo

@lervag
Copy link
Owner

lervag commented Aug 2, 2021

That might be possible, but it would be very helpful with more info. Especially, some good examples and reference to the relevant commands would be in order.

@rionda
Copy link
Contributor Author

rionda commented Aug 2, 2021

For example, I almost always declare the following for absolute values or set cardinalities:

\DeclarePairedDelimiter\abs{\lvert}{\rvert}

and use it as \abs{S} to get |S|. It is described in section 3.6 of the mathtools guide. Essentially, I would like the autocomplete to suggest \abs when I start typing \ab or similar.

\NewDocumentCommand and \DeclareDocumentCommand are a little more convoluted because they are extremely flexible, but all we care about is the name of the command that is declared.
Here is an example

\DeclareDocumentCommand\domain{mo}{% {method}[graph]
  \symcal{D}_{#1%
    \IfNoValueTF{#2}{}{,#2}%
  }%
}

which I can use as \domain{B} or \domain{B}[A]. They are described in the xparse documentation.

Hope this helps, and thanks for considering it.

Matteo

lervag added a commit that referenced this issue Aug 2, 2021
@lervag
Copy link
Owner

lervag commented Aug 2, 2021

Please test now. The xparse command was already supported, actually, but only with \DelcareDocumentCommand{...} syntax. I think it should work more generally now.

@lervag lervag closed this as completed Aug 2, 2021
@rionda
Copy link
Contributor Author

rionda commented Aug 2, 2021

Seem to work! Thank you!

@lervag
Copy link
Owner

lervag commented Aug 3, 2021

Glad to hear it! :)

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

No branches or pull requests

2 participants