Jorge Dorio
Jorge Dorio

Reputation: 21

How to config the autoformat no Lunar Vim

I'm newer on vim and your forks. To have a smoother transition I'm using Lunar Vim, but I need to change some option about the formatter, for example:

How I need to format:

<img src={ item.image } alt ={ item.descripton } />

But when I save, the Vim format like:

<img src={item.image} alt ={item.descripton} />

(Without spaces)

I need to change this, or remove the auto formatter.

Upvotes: 1

Views: 4211

Answers (1)

Nojipiz
Nojipiz

Reputation: 63

There are two ways to do this, you can do it with the easy way (answer of Jorge Dorino).

File: /home/user/.config/lvim/config.lua

lvim.format_on_save = true  -- Disable this line 

Or you can keep this line and activate the prettier formatter https://prettier.io/docs/en/options.html , and configure your own rules to html files formatting. (You need to install prettier or prettierd before do this)

File: /home/user/.config/lvim/config.lua

  local formatters = require "lvim.lsp.null-ls.formatters"
  formatters.setup {
    { exe = "prettierd", filetypes = { "html" } }
  }

Upvotes: 1

Related Questions