marleyvim/nvim/ftplugin/nix.lua

18 lines
377 B
Lua

-- Exit if the language server isn't available
if vim.fn.executable('nil') ~= 1 then
return
end
local root_files = {
'flake.nix',
'default.nix',
'shell.nix',
'.git',
}
vim.lsp.start {
name = 'nil_ls',
cmd = { 'nil' },
root_dir = vim.fs.dirname(vim.fs.find(root_files, { upward = true })[1]),
capabilities = require('user.lsp').make_client_capabilities(),
}