Replies: 7 comments 6 replies
-
It's mentioned in the docs where you should place your own customization right here. So you just create a file in return {
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
["html"] = { "prettier" },
},
},
},
}
You should never copy the entire from what's in the docs. Usually there's a warning about this in the docs, but for some reason in the formatting page it's missing.
So, in summary, you create files in |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply! I have added the "opts" in my plugin directory like this: (I have removed the "format_on_save" again - because that wasn't allowed). Nevertheless, navigating to an html file and pressing I have double checked, that The only hint I could find was this (but it doesn't tell me what the error is):
I can run prettier manually and it works:
|
Beta Was this translation helpful? Give feedback.
-
Did a bit more digging and found this, which made me check what I have installed, but everything looks fine: |
Beta Was this translation helpful? Give feedback.
-
What does |
Beta Was this translation helpful? Give feedback.
-
I can execute |
Beta Was this translation helpful? Give feedback.
-
What does |
Beta Was this translation helpful? Give feedback.
-
Looks kinda ok, except for the errors I posted above already. Unfortunately it doesn't tell me what error "prettier" has. Also if I clear that file, then try to Can I see the exact command nvim is executing somewhere? To reproduce it outside of the editor. |
Beta Was this translation helpful? Give feedback.
-
Did you check the docs?
Is your feature request related to a problem? Please describe.
I am trying to format html. It is not fully clear to me what the required steps are. Do I need to install conform.nvim? Do I need to install a language server, do I need to have npm, do I need prettier?
I started with the StarterTemplate which works great. I am really enjoying it and I am getting used more and more how to use everything. What I couldn't figure out so far what steps do I need to do to enable formatting (on save and on shortcut) for html.
<leader>cf
(while a html file is open) currently gives me "No formatter available". So I head over to Formatting which tells me I should useconform.nvim
- which seems to be installed (see screenshot).Formatting, also gives some configuration options:
opts
and I kind of understand that I need to add sth. likehtml = {"prettier"}
toformatters_by_ft
. Makes sense, but where?I cannot find
conform.nvim
anywhere in my.config/nvim/
folder except for one entry in./lazy-lock.json
. I followed this well-explained youtube video to enable formatting which lead to "Don't override plugin.config directly, since this will break LazyVim formatting."I also tried copying the "Full Spec" from Formatting into a new file in my plugins directory which also didn't work (the built-in lua LSP hinted at all sorts of errors).
Apologies for the lengthy description, but hopefully it makes it a bit clear what a new user of lazyvim might go through and struggle with.
Describe the solution you'd like
A simple example how/where to enable formatting for anything but what is enabled already.
Describe alternatives you've considered
Youtube :)
Additional context
Beta Was this translation helpful? Give feedback.
All reactions