Skip to content
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

Failed to run formatter sed #299

Open
supeep opened this issue Nov 24, 2023 · 3 comments
Open

Failed to run formatter sed #299

supeep opened this issue Nov 24, 2023 · 3 comments

Comments

@supeep
Copy link

supeep commented Nov 24, 2023

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

I have installed sed by scoop
image

Here is my formatter configuration file
Add:I realize that I used the wrong method name. .c should use astyle .java should use clangformat
97F4AE4F68AC3E558F34D3A45ABC2EA9

Here is the error message.
"Failed to run formatter sed ... : -e expression #1, char 1: unknown command: `''^M"
image

@supeep
Copy link
Author

supeep commented Nov 24, 2023

I'm sorry, I successfully formatted the .c file by changing from stylua to astyle, although it still reports the same error after formatting.
My configure is:

-- Utilities for creating configurations
local util = require "formatter.util"

-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").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 = {
      -- "formatter.filetypes.lua" defines default configurations for the
      -- "lua" filetype
      require("formatter.filetypes.lua").stylua,

    },

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

    java = {
      require("formatter.filetypes.java").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
    }
  }
}

@robamu
Copy link

robamu commented Nov 28, 2023

I have the same issue on Windows 11.

@Justin-Pennington
Copy link

Justin-Pennington commented Dec 17, 2024

(Windows 10)
Old comment I just had to switch
require("formatter.filetypes.any").remove_trailing_whitespace
to
require("formatter.filetypes.any").substitute_trailing_whitespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants