nvim-lint icon indicating copy to clipboard operation
nvim-lint copied to clipboard

Vale linter setup exits with code 2

Open pacoispaco opened this issue 1 year ago • 4 comments

I'm using Neovim v0.9.5 with nvim.lazy and have installed the nvim-lint plugin. I have installed the "Vale" linter with Mason. I have configured Vale in in the ~/.local/share/nvim/mason/packages/vale/ directory and verified I can run Vale there on the command line.

I have this config file for nvim-lint:

return {
    "mfussenegger/nvim-lint",
    event = {
        "BufReadPre",
        "BufNewFile",
        "BufWritePost",
    },
    config = function ()
        local lint = require("lint")

        lint.linters_by_ft = {
            text = { "vale", },
            markdown = { "vale", },
        }

        vim.api.nvim_create_autocmd({ "BufWritePost" }, {
            callback = function()
                require("lint").try_lint()
            end,
        })
    end,
}

I open a "test.md" file with some text in Neovim, when I save the buffer I get:

Linter command `vale` exited with code: 2

I get the same when I run this command in Neovim with the "test.md" file in the buffer:

:lua require("lint").try_lint()

I've looked in the log files in ~/.local/state/nvim/ but can see nothing from nvim-lint or Vale there

Any help in solving this would be appreciated.

pacoispaco avatar Feb 07 '24 17:02 pacoispaco

I ran into the same issue. Did you manage to resolve it?

dileep-kishore avatar Feb 27 '24 00:02 dileep-kishore

I'm encountering a similar issue. Executing Vale via the command line for a specific file yields the following output:

E100 [.vale.ini not found] Runtime error

no config file found

Execution stopped with code 1.

Placing a vale.ini configuration file at the root of the project appears to be a potential fix. However, this approach doesn't seem particularly optimal.

darkylein avatar Mar 11 '24 01:03 darkylein

You have to sync the vale package for the first usage:

  1. You can create a ~/.config/vale/.vale.ini file
  2. Then use full path to sync the mason package with the global config. ~/.local/share/nvim/mason/packages/vale/vale --config=$HOME/.config/vale/.vale.ini sync

This is my .vale.ini: StylesPath = . MinAlertLevel = suggestion Packages = RedHat, alex [*] BasedOnStyles = Vale, RedHat, alex

Use styles=. so it syncs your sytles to where the global config is store. I hate clutter in my home folder

EDIT: source: https://docs.rockylinux.org/books/nvchad/vale_nvchad/#__tabbed_1_2

hriva avatar Mar 19 '24 21:03 hriva

@hriva thanks for the link, fixed all my errors

ruskeyz avatar Jun 03 '24 16:06 ruskeyz

You have to sync the vale package for the first usage:

  1. You can create a ~/.config/vale/.vale.ini file
  2. Then use full path to sync the mason package with the global config. ~/.local/share/nvim/mason/packages/vale/vale --config=$HOME/.config/vale/.vale.ini sync

This is my .vale.ini: StylesPath = . MinAlertLevel = suggestion Packages = RedHat, alex [*] BasedOnStyles = Vale, RedHat, alex

Use styles=. so it syncs your sytles to where the global config is store. I hate clutter in my home folder

EDIT: source: https://docs.rockylinux.org/books/nvchad/vale_nvchad/#__tabbed_1_2

if you are in a macos the path is not ~/.config but $HOME/Library/Application Support/vale/.vale.ini as specied there

lucax88x avatar Aug 20 '24 20:08 lucax88x