Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: LazyVim/lua/lazyvim/plugins/treesitter.lua:17: attempt to index a nil value #312

Closed
3 tasks done
alexander-born opened this issue Feb 20, 2023 · 1 comment · Fixed by #313
Closed
3 tasks done
Labels
bug Something isn't working

Comments

@alexander-born
Copy link
Contributor

Did you check docs and existing issues?

  • I have read all the LazyVim docs
  • I have searched the existing issues of LazyVim
  • I have searched the exsiting issues of plugins related to this issue

Neovim version (nvim -v)

0.8.1

Operating system/version

Ubuntu 20.04

Describe the bug

Hey folke,

Thanks for the update on the treesitter-textobject, but there seems to be an issue, when not configuring all of "move", "select", "swap", "lsp_interop".

Failed to run `init` for **nvim-treesitter-textobjects**                                                                                                                                                                                                                 
...are/nvim/lazy/LazyVim/lua/lazyvim/plugins/treesitter.lua:17: attempt to index a nil value

Steps To Reproduce

lua/plugin/treesitter.lua

return {
  "nvim-treesitter/nvim-treesitter",
  opts = function(_, opts)
    table.insert(opts.ensure_installed, "cpp")
    opts.textobjects = {
      swap = {
        enable = true,
        swap_next = { ["<leader>sa"] = "@parameter.inner" },
        swap_previous = { ["<leader>sA"] = "@parameter.inner" },
      },
    }
  end,
}

Expected Behavior

no error

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/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", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/LazyVim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@alexander-born alexander-born added the bug Something isn't working label Feb 20, 2023
alexander-born pushed a commit to alexander-born/LazyVim that referenced this issue Feb 20, 2023
@alexander-born
Copy link
Contributor Author

Fix: #313
Have a good holiday!

folke pushed a commit that referenced this issue Feb 20, 2023
Co-authored-by: Alexander Born <alexander.born@bmw.de>
ofrades pushed a commit to ofrades/LazyVim that referenced this issue May 30, 2023
Co-authored-by: Alexander Born <alexander.born@bmw.de>
joshmedeski pushed a commit to joshmedeski/LazyVim that referenced this issue Sep 1, 2023
Co-authored-by: Alexander Born <alexander.born@bmw.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant