mhartington/formatter.nvim

buffer not updated after :Format

Closed this issue · 4 comments

Greetings!

I've been using this plugin for months with prettier. Nice job!

Today I tried setting up the golang formatter gofmt and when I run :Format the current file open doesn't get updated. It's only after I run :e do I see the changes.

require('formatter').setup {
    logging = false,
    filetype = {
      go = {
        function()
          return {
            exe = "gofmt",
            args = { "-w" },
            stdin = true
          }
        end
      },
    }
  }

the documentation for gofmt is wrong, there should be no arguments.

Thanks for the reply! Unfortunately, that doesn't work either.

I stand corrected! That appears to work, thanks!

Same problem, but with bibtex-tidy.

require("formatter").setup {
  filetype = {
        bib = {
            function ()
                return {
                    exe = "bibtex-tidy",
                    args = {
                        "--curly",
                        "--no-numeric",
                        "--space=4",
                        "--align=13",
                        "--duplicates=doi",
                        "--no-escape",
                        "--quiet",
                        "--strip-enclosing-braces",
                        "--encode-urls",
                        "--sort-fields=title,shorttitle,author,year,month,day,journal,booktitle,location,on,publisher,address,series,volume,number,pages,doi,isbn,issn,url,urldate,copyright,category,note,metadata",
                        util.escape_path(util.get_current_buffer_file_path()),
                    },
                    stdin = true,
                    try_node_modules = true,
                }
            end
        },
  }
}