Skip to content

Failed to run formatter sed #299

Description

@supeep

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

Activity

  1. supeep commented on Nov 24, 2023

    @supeep
    Author

    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
        }
      }
    }
    
  2. robamu commented on Nov 28, 2023

    @robamu

    I have the same issue on Windows 11.

  3. Justin-Pennington commented on Dec 17, 2024

    @Justin-Pennington

    (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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions