Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Question: lua replacement for executable()? #83

Closed
n8henrie opened this issue Oct 9, 2021 · 2 comments
Closed

Question: lua replacement for executable()? #83

n8henrie opened this issue Oct 9, 2021 · 2 comments

Comments

@n8henrie
Copy link

n8henrie commented Oct 9, 2021

Hello,

I hope opening an issue for this type of question is okay!

Is there a recommended lua replacement for vimscript's executable()?

My use-case is that I share a config between several machines, not all of which have the same language servers.

Instead of e.g. if executable("bash-language-server"), currently I'm using:

if os.execute("command -v bash-language-server") == 0 then
    nvim_lsp.bashls.setup({
    on_attach = default_lsp_on_attach,
    })
end

Is there a recommended alternative?

@nanotee
Copy link
Owner

nanotee commented Oct 9, 2021

Hello! Questions are definitely okay, but I would recommend the Neovim Discourse or the Matrix Room to get more eyeballs on your problem

As for executable(), that should already be covered by vim.fn since it's a Vimscript function:

if vim.fn.executable("bash-language-server") == 1 then
    nvim_lsp.bashls.setup({
    on_attach = default_lsp_on_attach,
    })
end

@n8henrie
Copy link
Author

n8henrie commented Oct 9, 2021

Thank you! Have used the subreddit a few times, will check out those resources as well.

@n8henrie n8henrie closed this as completed Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants