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

Provide g:vimtex_format_border_beginning and g:vimtex_format_border_end options to custom formatting rule #2358

Closed
wenpengy opened this issue Mar 22, 2022 · 1 comment

Comments

@wenpengy
Copy link

wenpengy commented Mar 22, 2022

The function vimtex#format#formatexpr defined in format.vim script just supports s:border_beginning and s:border_end variables. Is it possible to provide global variables g:vimtex_format_border_beginning and g:vimtex_border_end for user?

For example, when format following codes using gqap:

\begin{figure}[htpb]
  \centering
  \includegraphics[scale=1.0]{fig1}
  \caption{A long title a long title a long title a long title a long title a long title a long title}%
  \label{f:fig1}
\end{figure}
``` latex

The result is :

``` latex
\begin{figure}[htpb] \centering \includegraphics[scale=1.0]{fig1}
  \caption{A long title a long title a long title a long title a long title a long title a long title}%
  \label{f:fig1}
\end{figure}
``` latex

The  expected result is:
``` latex
\begin{figure}[htpb]
  \centering
  \includegraphics[scale=1.0]{fig1}
  \caption{A long title a long title a long title a long title a long title
    a long title a long title}%
  \label{f:fig1}
\end{figure}

Therefore, it is very convenient for user to custom formatting style if you can provide global variables.

Thank you very much!

@wenpengy wenpengy changed the title Provide g:vimtex_format_border_beginning and g:vimtex_border_end options to custom formatting rule Provide g:vimtex_format_border_beginning and g:vimtex_format_border_end options to custom formatting rule Mar 22, 2022
@lervag
Copy link
Owner

lervag commented Mar 24, 2022

The function vimtex#format#formatexpr defined in format.vim script just supports s:border_beginning and s:border_end variables. Is it possible to provide global variables g:vimtex_format_border_beginning and g:vimtex_border_end for user?

Yes, that could be possible. But I'm curious, perhaps it is a better effort to instead improve the built-in private variables so everyone can benefit?

Of course, we could do both.

lervag added a commit that referenced this issue Mar 24, 2022
@lervag lervag closed this as completed Mar 24, 2022
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