toppair / reach.nvim

Buffer, mark, tabpage, colorscheme switcher for Neovim
MIT License
239 stars 7 forks source link

ReachOpen buffers triggers attempt to index upvalue 'cache_cwd' (a nil value) #1

Closed jemag closed 2 years ago

jemag commented 2 years ago

Currently doing ReachOpen buffers gives the following error:

E5108: Error executing lua ...im/site/pack/packer/start/reach.nvim/lua/reach/cache.lua:126: attempt to index upvalue 'cache_cwd' (a nil value)
stack traceback:
        ...im/site/pack/packer/start/reach.nvim/lua/reach/cache.lua:126: in function 'get'
        .../pack/packer/start/reach.nvim/lua/reach/buffers/sort.lua:31: in function 'sort_priority'
        ...cker/start/reach.nvim/lua/reach/buffers/make_buffers.lua:91: in function 'make_buffers'
        ...vim/site/pack/packer/start/reach.nvim/lua/reach/init.lua:30: in function 'buffers'
        [string ":lua"]:1: in main chunk

nvim --version:

NVIM v0.7.0-dev+1242-gab456bc30
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/jemag/Projects/github-reference/neovim/src/build/config -I/home/jemag/Projects/github-reference/neovim/src/src -I/home/jemag/Projects/github-reference/neovim/src/.deps/usr/include -I/usr/include -I/home/jemag/Projects/github-reference/neovim/src/build/src/nvim/auto -I/home/jemag/Projects/github-reference/neovim/src/build/include
Compiled by jemag@archhome

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/jemag/Projects/github-reference/neovim/build/share/nvim"

Run :checkhealth for more info

Reproduction steps:

  1. Open a file with minimal_init.lua: nvim --noplugin -u minimal_init.lua error.yaml
  2. Enter the cmd: ReachOpen buffers
  3. Notice error

minimal_init.lua:

local on_windows = vim.loop.os_uname().version:match 'Windows'
vim.api.nvim_command("!rm -rf /tmp/nvim")

local function join_paths(...)
  local path_sep = on_windows and '\\' or '/'
  local result = table.concat({ ... }, path_sep)
  return result
end

vim.cmd [[set runtimepath=$VIMRUNTIME]]

local temp_dir = vim.loop.os_getenv 'TEMP' or '/tmp'

vim.cmd('set packpath=' .. join_paths(temp_dir, 'nvim', 'site'))

local package_root = join_paths(temp_dir, 'nvim', 'site', 'pack')
local install_path = join_paths(package_root, 'packer', 'start', 'packer.nvim')
local compile_path = join_paths(install_path, 'plugin', 'packer_compiled.lua')

local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      'toppair/reach.nvim'
    },
    config = {
      package_root = package_root,
      compile_path = compile_path,
    },
  }
end

if vim.fn.isdirectory(install_path) == 0 then
  vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }
  load_plugins()
  require('packer').sync()
else
  load_plugins()
  require('packer').sync()
end

Marks and tabpages work fine

toppair commented 2 years ago

Okay, so it looks like the setup function is not being called? You need to run:

require('reach').setup()
jemag commented 2 years ago

wow my bad, for some reason I thought it was only needed to pass the options. I have countless other plugins where I do call setup. Sorry for that