GithubHelp home page GithubHelp logo

inner environment begin pattern about vimtex HOT 10 CLOSED

lervag avatar lervag commented on May 22, 2024
inner environment begin pattern

from vimtex.

Comments (10)

lervag avatar lervag commented on May 22, 2024

Could you explain why it should be xmap instead of vmap (why should it not also work for selection mode)?

And to see if I understand: You mean that the inner part of the environment should not contain a command following the \begin{...} such as a \label{...}? When I do vie for the following example:

\begin{test}\label{a:test}
  asd[cursor here]
  asd
\end{test}

Then everything between (and including) \label{a:test} and the last asd is selected.

Oh, and btw: This is vim-latex, not LaTeX-Box, so the mapping you are referring to is

vnoremap <silent><buffer> ie :<c-u>call latex#motion#sel_environment(1)<cr>

from vimtex.

Konfekt avatar Konfekt commented on May 22, 2024

In Sélection mode, hitting a printable character is supposed to replace the selection.

Yep, that's what I meant. Does it sound reasonable? Over here it always gets in the way, for example when indenting the inner environment. Give it a try.

Yep, I accidently pasted from Latexbox..

from vimtex.

lervag avatar lervag commented on May 22, 2024

Ah, I see. Changed to xmap now.

I still don't really understand the problem here. To me it seems natural to select everything inside the environment as it is done. However, I might change my mind if I understand the problem better. I propose that you provide a full example where you explain what you do, what happens, and what you expected should happen.

from vimtex.

Konfekt avatar Konfekt commented on May 22, 2024

For example, consider the array environment that takes mandatory arguments.

Then, in my eyes, (rcl) belongs to the delimiting part in

begin(array)(rcl)

...

end(array)

from vimtex.

Konfekt avatar Konfekt commented on May 22, 2024

Then hitting >ie at... would indent the line begin(array) (rcl) too. Expected is only the indenting of ...

from vimtex.

lervag avatar lervag commented on May 22, 2024

Agreed, that's a valid example. I'll see what I can do.

from vimtex.

lervag avatar lervag commented on May 22, 2024

The last commit should improve this for your given example.

from vimtex.

Konfekt avatar Konfekt commented on May 22, 2024

Ok, so when I read the changed vim reg correctly the last example could convince you, thanks for fixing it...

but the label keeps being considered part of the inner environment. For me it belongs to the declarative part of the environment and the beginning line in

\begin{test}\label{a:test}
  asd[cursor here]
  asd
\end{test}

should not be indented when hitting >ie at asd, but I have no technical argument at hand and leave it at that until I can come up with one.

from vimtex.

lervag avatar lervag commented on May 22, 2024

Yes, I am still convinced that the \label{...} part should be a part of the inner environment. I've never seen it specified that one is supposed to place the \label just after opening an environment. And for the figure environment, one is even adviced to put the \label command after the \caption command, see here.

Personally, I often format my labelled environments like this:

\begin{test}
  \label{a:test}
  ...
\end{test}

or like this:

\begin{test}
  ...
  \label{a:test}
\end{test}

from vimtex.

Konfekt avatar Konfekt commented on May 22, 2024

Ok I leave it at that.

from vimtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.