[mirror] Make your go dev experience better
github.com/olexsmir/gopher.nvim
neovim
golang
1local function root(p)
2 local f = debug.getinfo(1, "S").source:sub(2)
3 return vim.fn.fnamemodify(f, ":p:h:h") .. "/" .. (p or "")
4end
5
6local function install_plug(plugin)
7 local name = plugin:match ".*/(.*)"
8 local package_root = root ".tests/site/pack/deps/start/"
9 if not vim.uv.fs_stat(package_root .. name) then
10 print("Installing " .. plugin)
11 vim.fn.mkdir(package_root, "p")
12 vim.fn.system {
13 "git",
14 "clone",
15 "--depth=1",
16 "https://github.com/" .. plugin .. ".git",
17 package_root .. "/" .. name,
18 }
19 end
20end
21
22vim.env.XDG_CONFIG_HOME = root ".tests/config"
23vim.env.XDG_DATA_HOME = root ".tests/data"
24vim.env.XDG_STATE_HOME = root ".tests/state"
25vim.env.XDG_CACHE_HOME = root ".tests/cache"
26
27vim.cmd [[set runtimepath=$VIMRUNTIME]]
28vim.opt.runtimepath:append(root())
29vim.opt.packpath = { root ".tests/site" }
30vim.notify = print
31
32install_plug "nvim-lua/plenary.nvim"
33install_plug "nvim-treesitter/nvim-treesitter"
34install_plug "echasnovski/mini.doc" -- used for docs generation
35install_plug "echasnovski/mini.test"
36
37-- install go treesitter parse
38require("nvim-treesitter.install").ensure_installed_sync "go"
39
40-- setup mini.test only when running headless nvim
41if #vim.api.nvim_list_uis() == 0 then
42 require("mini.test").setup {
43 collect = {
44 find_files = function()
45 return vim.fn.globpath("spec", "**/*_test.lua", true, true)
46 end,
47 },
48 }
49end