mhartington/formatter.nvim

Can't format veirlog files by verible-verilog-format

kdurant opened this issue · 1 comments

            verilog = {
                function()
                    return {
                        exe = "verible-verilog-format",
                        args = { "--indentation_spaces 4", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) },
                        stdin = true,
                    }
                end,
            },

    vim.api.nvim_create_autocmd({ "BufWritePost" }, {
        pattern = { "*.h", "*.hpp", "*.c", "*.cpp", "*.py", "*.lua", "*.v", "CMakeLists.txt" },
        command = "FormatWrite",
    })

Change that to this:

            verilog = {
                function()
                    return {
                        exe = "verible-verilog-format",
                        args = { "--indentation_spaces 4", "-" },
                        stdin = true,
                    }
                end,
            },

    vim.api.nvim_create_autocmd({ "BufWritePost" }, {
        pattern = { "*.h", "*.hpp", "*.c", "*.cpp", "*.py", "*.lua", "*.v", "CMakeLists.txt" },
        command = "FormatWrite",
    })

You shouldn't be giving the filename and setting the stdin flag, it should be one or the other. The above method uses standard input.