From af4de6a35d128ce71c75a9a7846bf089aea76f50 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sat, 29 Jun 2024 12:57:09 +0200 Subject: [PATCH] chore(troubleshooting/minimal.lua): use lazy.minit --- .github/ISSUE_TEMPLATE/bug_report.yml | 21 +++++++-- .gitignore | 1 + README.md | 3 +- troubleshooting/minimal.lua | 64 ++++++--------------------- 4 files changed, 34 insertions(+), 55 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 45ae5a1e..a859de02 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -77,10 +77,25 @@ body: attributes: label: "The minimal config used to reproduce this issue." description: | - See [this example](https://github.com/mrcjkb/rustaceanvim/blob/master/troubleshooting/minimal.lua). + Run with `nvim -u minimal.lua` placeholder: | - -- Paste your minimal config here. Please base it on the example provided by this plugin, - -- including any additional plugins that must be installed for the issue to be reproducible. + vim.env.LAZY_STDPATH = '.repro' + load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))() + + require('lazy.minit').repro { + spec = { + { + 'mrcjkb/rustaceanvim', + version = '^4', + init = function() + -- Configure rustaceanvim here + vim.g.rustaceanvim = {} + end, + lazy = false, + }, + }, + } + -- do anything else you need to do to reproduce the issue render: "Lua" validations: required: true diff --git a/.gitignore b/.gitignore index 0455426d..8304204b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ doc/tags result/ .direnv .luarc.json +.repro diff --git a/README.md b/README.md index ddd0cdf2..6b6a2b89 100644 --- a/README.md +++ b/README.md @@ -838,8 +838,7 @@ To troubleshoot this plugin with a minimal config in a temporary directory, you can try [minimal.lua](./troubleshooting/minimal.lua). ```console -mkdir -p /tmp/minimal/ -NVIM_DATA_MINIMAL="/tmp/minimal" NVIM_APP_NAME="nvim-minimal" nvim -u NORC -u minimal.lua +nvim -u minimal.lua ``` > [!NOTE] diff --git a/troubleshooting/minimal.lua b/troubleshooting/minimal.lua index 2a54b69d..0de2ea43 100644 --- a/troubleshooting/minimal.lua +++ b/troubleshooting/minimal.lua @@ -1,52 +1,16 @@ --- Minimal nvim config with lazy --- Assumes a directory in $NVIM_DATA_MINIMAL --- Start with --- --- export NVIM_DATA_MINIMAL=$(mktemp -d) --- export NVIM_APP_NAME="nvim-ht-minimal" --- nvim -u NORC -u minimal.lua --- --- Then exit out of neovim and start again. +vim.env.LAZY_STDPATH = '.repro' +load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))() --- Ignore default config -local config_path = vim.fn.stdpath('config') -vim.opt.rtp:remove(config_path) - --- Ignore default plugins -local data_path = vim.fn.stdpath('data') -local pack_path = data_path .. '/site' -vim.opt.packpath:remove(pack_path) - --- bootstrap lazy.nvim -data_path = assert(os.getenv('NVIM_DATA_MINIMAL'), '$NVIM_DATA_MINIMAL environment variable not set!') -local lazypath = data_path .. '/lazy/lazy.nvim' -local uv = vim.uv - ---@diagnostic disable-next-line: deprecated - or vim.loop -if not uv.fs_stat(lazypath) then - vim.fn.system { - 'git', - 'clone', - '--filter=blob:none', - 'https://github.com/folke/lazy.nvim.git', - '--branch=stable', - lazypath, - } -end -vim.opt.rtp:prepend(lazypath) - -local lazy = require('lazy') - -lazy.setup({ - { - 'mrcjkb/rustaceanvim', - version = '^4', - init = function() - -- Configure rustaceanvim here - vim.g.rustaceanvim = {} - end, - lazy = false, +require('lazy.minit').repro { + spec = { + { + 'mrcjkb/rustaceanvim', + version = '^4', + init = function() + -- Configure rustaceanvim here + vim.g.rustaceanvim = {} + end, + lazy = false, + }, }, - -- Add any other plugins needed to reproduce the issue. - -- see https://github.com/folke/lazy.nvim#-lazynvim for details. -}, { root = data_path, state = data_path .. '/lazy-state.json', lockfile = data_path .. '/lazy-lock.json' }) +}