Skip to content

Minimal init.lua to report bugs

Jakson Alves de Aquino edited this page Oct 8, 2023 · 1 revision

When reporting a bug, it is recommended to run Neovim with a minimal init.lua to ensure that the problem really is a Nvim-R bug and not something caused by another plugin. The procedure below works on Linux and uses lazy.nvim as the plugin manager that will install Nvim-R as the only plugin. The procedure consists of (1) either deleting or moving your current configuration so that Neovim cannot find it and, then, (2) creating an init.lua as the single Neovim's configuration file.

First, move or delete your current configuration:

# Delete directories that will be regenerated automatically:
rm -rf ~/.cache/nvim ~/.local/share/nvim

# Rename ~/.config/nvim as ~/.config/nvim_real (so you can recover it later):
cd ~/.config
mv nvim nvim_real

# Create a new ~/.config/nvim directory
mkdir ~/.config/nvim

Then, create a new ~/.config/nvim/init.lua with the following contents:

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({ 'jalvesaq/Nvim-R' }, {})

Now, you should:

  • Start nvim (lazy.nvim will be installed and, then, it will install Nvim-R).
  • Close nvim.
  • Start editing an R file (remember that the LocalLeader is \ and that you have to press \rf to start R and \d to send a line to R Console).
  • Check if the bug is still there.

Finally, recover your original configuration:

cd ~/.config
mv nvim nvim_minimal
mv nvim_real nvim