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

Error with Neovim 0.9 #14

Open
cristobaltapia opened this issue May 8, 2023 · 3 comments · May be fixed by #16
Open

Error with Neovim 0.9 #14

cristobaltapia opened this issue May 8, 2023 · 3 comments · May be fixed by #16

Comments

@cristobaltapia
Copy link

Hi, this plugin has been working for me perfectly for some years (so much that I had forgotten I had it installed :) ). But I think that the latest version of neovim introduced a problem:

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/lua/editorconfig.lua:210: Invalid buffer id: 1                                                                                  
stack traceback:
        [C]: in function 'nvim_buf_get_name'
        /usr/share/nvim/runtime/lua/editorconfig.lua:210: in function 'config'
        /usr/share/nvim/runtime/plugin/editorconfig.lua:11: in function </usr/share/nvim/runtime/plugin/editorconfig.lua:4>

Do you think this is a problem with neovim or with vim-symlink? Do you think that this can be fixed easily? I tried today for a while, but I am not sure where the problem might be.

@Jasha10
Copy link

Jasha10 commented May 20, 2023

The traceback points to runtime/lua/editorconfig.lua:210.
That line of code looks like this:

  local path = vim.fs.normalize(vim.api.nvim_buf_get_name(bufnr))

The traceback gives the error message Invalid buffer id: 1 . This makes me think that the function call vim.api.nvim_buf_get_name(bufnr) on that line of code is failing because bufnr == 1 is invalid.

Looking at the code of this vim-symlink plugin, I see that there is a call to Bwipeout or bwipeout:

...
  if exists(':Bwipeout') " vim-bbye
    silent! Bwipeout
  else
    if &diff
      echoerr "symlink.vim: 'moll/vim-bbye' is required in order for this plugin to properly work in diff mode"
      return
    endif
    enew
    bwipeout #
  endif
...

I suspect that the call to Bwipeout is causing bufnr == 1 to be invalid.

@Jasha10
Copy link

Jasha10 commented May 20, 2023

After much experimenting, I've found a workaround: Changing the BufRead autocmd in vim-symlink into a BufEnter autocmd. So far I haven't noticed any negative side-effects from making this change. I'll submit a PR.

EDIT:
I've submitted PR #16.

I'm still seeing some issues after changing to BufEnter

  autocmd BufEnter * nested call s:on_buf_read(expand('<afile>'))
  " Works for first file. Subsequent :edit ~/my_symlink gave error:
    " python3-rplugin-host: Async request caused an error:
    " Vim(sign):E158: Invalid buffer name: 4
    " python3-rplugin-host: Async request caused an error:
    " Invalid buffer id: 4

Jasha10 added a commit to Jasha10/vim-symlink that referenced this issue May 20, 2023
This PR replaces the `BufRead` autocmd with `BufEnter.
Closes aymericbeaumet#14.
See me comments on that issue.

In addition to `BufEnter`, I also tried several other autocmd events:
- `BufWinEnter`
- `BufEnter`
- `BufNew`
- `BufAdd`
- `BufWinEnter`
All of these other attempts failed with various incorrect behavior or errors (some of which originated from other neovim plugins that I have installed).
@Jasha10 Jasha10 linked a pull request May 20, 2023 that will close this issue
@yut23
Copy link

yut23 commented Jul 30, 2023

An alternative workaround I've been using is to entirely disable Neovim's EditorConfig integration (see https://neovim.io/doc/user/editorconfig.html#editorconfig), since I use a separate EditorConfig plugin anyways for vim compatibility.

cristobaltapia added a commit to cristobaltapia/dotfiles_main that referenced this issue Aug 1, 2023
yut23 added a commit to yut23/neovim-homeshick that referenced this issue May 9, 2024
It doesn't like vim-symlink, and I'm using a separate plugin anyways.
See aymericbeaumet/vim-symlink#14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants