馃崚 YAML toolkit for Neovim users
1-- In Nixery (container test and CI) fzf-lua fails to load with LuaJIT 5.1 (the
2-- version in the Nix package), but it is something we can ignore for simple
3-- tests.
4if vim.fn.isdirectory("/nix/store") == 1 then
5 _VERSION = "Lua 5.2"
6end
7
8local install_from_github = function(uri)
9 local repo = string.gsub(uri, "^[^/]+/", "")
10 local name = string.gsub(repo, "%p?nvim%p?", "")
11 local env = string.upper(name) .. "_DIR"
12 local dir = os.getenv(env)
13 if dir == nil then
14 dir = "/tmp/" .. repo
15 end
16
17 if vim.fn.isdirectory(dir) == 0 then
18 print(vim.fn.system({ "git", "clone", "https://github.com/" .. uri, dir }))
19 end
20
21 vim.opt.rtp:append(dir)
22 vim.cmd("runtime plugin/" .. repo)
23end
24
25local dependencies = {
26 "folke/snacks.nvim",
27 "ibhagwan/fzf-lua",
28 "nvim-lua/plenary.nvim",
29 "nvim-telescope/telescope.nvim",
30 "nvim-treesitter/nvim-treesitter",
31}
32for _, dep in pairs(dependencies) do
33 install_from_github(dep)
34end
35
36vim.opt.rtp:append(".")
37vim.cmd("runtime plugin/yaml.vim")
38vim.cmd("set noswapfile")
39
40require("nvim-treesitter").install({ "yaml" }):wait()
41require("plenary.busted")