mhartington/formatter.nvim

[Error]Failed to run formatter sed

Opened this issue · 6 comments

I am using the Windows 11 system, Neovim version 0.9.0. After installing and configuring formatter.nvim, I used the ': Format' command in the '. py' file and generated an error warning without formatting the file.

Here is my formatter configuration file and a part of nvim configuration file.

Snipaste_2023-04-24_00-13-03

Snipaste_2023-04-24_00-14-18

Here is the error message.
Snipaste_2023-04-24_00-14-45

By the way, I am using anaconda Python 3.10, which is also configured with flask8, auto8, yakl

You need to install sed

I have the same problem. So is that mean sed is required for any formatters?

No, just the ones that uses it

No, just the ones that uses it

Hmm. Feel confused. For example, I've configured that Lua uses stylua to format. But it still complains that sed is not found. If I install sed and configure the PATH (BTW, on Windows), the error message is disappeared and works well. My configure is:

formmater.setup {
  -- Enable or disable logging
  logging = true,
  -- Set the log level
  log_level = vim.log.levels.WARN,
  -- All formatter configurations are opt-in
  filetype = {
    -- Formatter configurations for filetype "lua" go here
    -- and will be executed in order
    lua = {
      require("formatter.filetypes.lua").stylua,
    },

    c = {
      require("formatter.filetypes.c").clangformat,
    },

    cpp = {
      require("formatter.filetypes.c").clangformat,
    },

    -- Use the special "*" filetype for defining formatter configurations on
    -- any filetype
    ["*"] = {
      -- "formatter.filetypes.any" defines default configurations for any
      -- filetype
      require("formatter.filetypes.any").remove_trailing_whitespace,
    },
  },
}

Is that mean ["*"] will match all the filetypes despite lua is matched before? If so, I think I got it.