-
Notifications
You must be signed in to change notification settings - Fork 189
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
Preserve initial indent of text when using latexindent #204
Comments
I'm having the same issue because I extract portions of the code (JSX inside of Javascript React files) using syntax markers and throw it into html-beautifier, but the result comes back without the block's indentation. When I faced a similar problem using another tool, I'd compare the indent of the previous line and add the amount + &shiftwidth to all lines in the formatter's output. Would that be a proper solution, or does it need to more (e.g. look further than the immediately previous line)? |
Looking at the indent of the first line of the visual selection solves my problem. But there might be other use cases, that require different handling. |
I've developed a naive code that repeats the indent character (spaces or tabs) N times + 1 based on the previous line, but I think it would be better to instead support any user-defined post-processing function through a formatter option, and have the indentation function around as a helper function like any other. Nevertheless, I'll look to open the PR later. |
I would like to see an option for preserving indentation when using Neoformat to format visual line selection. My use case is similar to http://github.com/prettier/prettier/issues/1324 but maybe this would make sense if built into neoformat instead of formatting tools. |
I currently use latexindent to format only portions of my LaTeX source code, mostly text blocks in between the mathematical stuff. When running
:Neoformat
on an indented visual selection the formatter removes the indentation.Before:
After:
It would be nice, if, when running the formatter on a visual selection, the initial indentation level is preserved. Since this might not be the preferred default for everyone, maybe this feature can be incorporated as an option?
The text was updated successfully, but these errors were encountered: