Hierarchical snippet for Tex lists

Asked by Jonas Diemer

Hi,

I just tried Ultisnips for TeX. I would like to have the following behavior:

I would like to enter

item<tab>One<cr>Two<cr>

and end up with

\begin{itemize}
  \item One
  \item Two
\end{itemize}

Is this possible with Ultisnip? How would I change the default TeX item snippet to work like this?

Thanks in advance.

Regards
Jonas

Question information

Language:
English Edit question
Status:
Solved
For:
UltiSnips Edit question
Assignee:
No assignee Edit question
Solved by:
SirVer
Solved:
Last query:
Last reply:
Revision history for this message
SirVer (sirver) said :
#1

Ultisnips does not offer the feature you seek as Vim does have it already. See formatoptions and this SO post might help you get started on the right track:

http://superuser.com/questions/422214/vim-gq-command-to-re-wrap-paragraph-and-latex

Revision history for this message
Jonas Diemer (diemer) said :
#2

Thanks for the reply! But I think your answer does not fully match my
question. I am not concerned about aligning the item tags, I don't even
want to type them.

Ideally, ultisnips should know that I am inside the itemize template and
every new line should start with the item tag.

I am used to this behavior from other editors and sort of miss it.
Would ultisnips be able to do that?

Regards
Jonas
Am 17.12.2012 07:25 schrieb "SirVer" <email address hidden>:

> Your question #216958 on UltiSnips changed:
> https://answers.launchpad.net/ultisnips/+question/216958
>
> Status: Open => Answered
>
> SirVer proposed the following answer:
> Ultisnips does not offer the feature you seek as Vim does have it
> already. See formatoptions and this SO post might help you get started
> on the right track:
>
> http://superuser.com/questions/422214/vim-gq-command-to-re-wrap-
> paragraph-and-latex
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ultisnips/+question/216958/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ultisnips/+question/216958
>
> You received this question notification because you asked the question.
>

Revision history for this message
Best SirVer (sirver) said :
#3

I am aware what you want and Vim can do it by defining \item as a comment leader and adding formatoptions+=c . Ultisnips can not help you there. Please google for a solution.

Revision history for this message
Jonas Diemer (diemer) said :
#4

Okay, thanks for the clarification!
Am 17.12.2012 07:45 schrieb "SirVer" <email address hidden>:

> Your question #216958 on UltiSnips changed:
> https://answers.launchpad.net/ultisnips/+question/216958
>
> Status: Open => Answered
>
> SirVer proposed the following answer:
> I am aware what you want and Vim can do it by defining \item as a
> comment leader and adding formatoptions+=c . Ultisnips can not help you
> there. Please google for a solution.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/ultisnips/+question/216958/+confirm?answer_id=2
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ultisnips/+question/216958
>
> You received this question notification because you asked the question.
>

Revision history for this message
Jonas Diemer (diemer) said :
#5

Thanks SirVer, that solved my question.