-
-
Notifications
You must be signed in to change notification settings - Fork 220
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
Autoformat file #874
Comments
Indenting, which is most of the formatting needed, should be handled out of the box. You can check what the indent expression is set to with There is no norg formatter atm, but since indentation handles most of the formatting, For line widths and style issues, you'll have to handle these manually. |
You can also set this up with a little vim knowledge. There are cases where this is harmful, i.e. if you have manual formatting that you don't want the indent engine to touch. An easy example is code blocks which do not have treesitter indent support ( |
Found this. Maybe you can try it out? |
That project isn't functional yet, it still has a long way to go before it's usable so the best solution for now is the native Neovim |
What are the formatting directives? I ask to configure. |
That's a nice builtin method, but it does not play nicely with metadata. The categories are always pushed to the line beginning. |
do you still have this issue now on NVIM v0.9.2 with Neorg v6.0.0? the built-in method should we close this old issue? |
Yes, this method now works perfectly for almost all situation for me. One last issue I have is in between -- Before ** Usage
*** Template Norg Files
@code norg
* {TITLE_INPUT}
Weather: {WEATHER}
{{:{YESTERDAY}:}}[Yesterday] - {{:{TOMORROW}:}}[Tomorrow]
** Daily Review
- {CURSOR}
@end -- After ** Usage
*** Template Norg Files
@code norg
* {TITLE_INPUT}
Weather: {WEATHER} <- This line
{{:{YESTERDAY}:}}[Yesterday] - {{:{TOMORROW}:}}[Tomorrow] <- This line
** Daily Review
- {CURSOR} <- This line
@end
This issue does not happen on lua code block I only found this behavior in norg code blocks (tho I haven't tested for all). This file is the one I'm having problem with. |
I have just tested some other languages and these are the result on NVIM v0.9.2 with Neorg v6.0.0
I believe we should close this issue and open another issue for this "Auto-indent/format with |
Thanks @leongjs98 for testing!
Nice title. Tho I believe you mistyped |
I do not think this issue should be closed as it tracks a general formatter, not just indentation. For example removing extra empty lines or formatting And besides that I think there are more things that auto-indent doesn't cover. I tried with the 1.0 specification and it produces a fairly large diff. I'm not familiar enough with neorg to pinpoint if all are valid or if the specification file itself isn't formatted correctly from the start, but I do think there are some auto-indent issues with that file. |
Yes, I mistyped. Thanks for spotting it! will open a specific issue right away. |
My point of closing this issue is that it's hard to solve a problem when we don't know the specifics of the problem. And L The example in the original issue:
is solved with the newer version of NeoVim and Neorg Other than that, the original issue didn't have other specific formating issue. And the actual issues are scattered around in the comments. This just makes it harder for the developer to try to solve this. Whilst the formater can definitely be improved, my suggestion is to open new issues with more specifics so it's easier to discuss and solve them. |
Good points! Closing this. |
Issues
Feature description
I'm not sure if this is already possible or if this a feature request, but I'd like to format .norg files when saved.
For me this is super convenient and it's a good timesaver. For instance, sometimes the content under headings aren't indented correctly and now I need to indent them manually (visual selection with
=
works ok). Of course formatting is more than just indentation, this is just an example.Is this possible somehow? Either with autocmd or something like Neoformat.
Help
No
Implementation help
No response
The text was updated successfully, but these errors were encountered: