packer.nvim icon indicating copy to clipboard operation
packer.nvim copied to clipboard

Way to get or add luarocks package bin path

Open s1n7ax opened this issue 4 years ago • 3 comments
trafficstars

I installed luaformatter but when running :Format command, it cannot find lua-format.

use {
    'mhartington/formatter.nvim',
    config = function()
        require("formatter").setup({
            logging = false,
            filetype = {
                lua = {
                    function()
                        return {exe = "lua-format", args = {}, stdin = true}
                    end
                },
            }
        })
    end
}

However I noticed the lua-format bin is available under following directory.

 ~/.cache/nvim/packer_hererocks/2.0.5/bin

Is there a way to get the path to bin grammatically so I can set env.

s1n7ax avatar Jul 26 '21 21:07 s1n7ax

Wrong project? :)

gegoune avatar Jul 26 '21 21:07 gegoune

Did you install lua-format via packer's Luarocks integration? That's a somewhat unusual use of it - it's mostly meant for installing libraries as modules.

I wouldn't really recommend installing binaries this way, but you could look at the code in packer.luarocks to see what paths we do/could possibly expose for this kind of use.

wbthomason avatar Jul 27 '21 03:07 wbthomason

I can't think of a reason why I shouldn't do this. formatter depends on one of the packages. In this case it happened to be a binary.

I have no clue how to add bin to the PATH. But I created a pull request to add an API to expose the path to bin. #515

s1n7ax avatar Jul 27 '21 12:07 s1n7ax