You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple files are opened when invoking nvim from the command line, :CommandTBuffer doesn't know about all the buffers. I am not sure if that is by design or not. This makes switching buffers with command-t impossible until all the buffers are cycled through with :bnext or similar. Once that is done, :CommandTBuffer knows about all the buffers.
Definitely not by design, but it's a consequence of this logic in the buffer finder:
List all buffers with vim.api.nvim_list_bufs()
For each buffer, check it is loaded with vim.api.nvim_buf_is_loaded(); if it is:
Get the name with vim.api.nvim_buf_get_name(); and:
Turn it into a relative path with vim.fn.fnamemodify().
So, the intent of the nvim_buf_is_loaded check is to skip over "unloaded" buffers, which can cause problems. The api-buffer docs say this about unloaded buffers:
Unloaded Buffers: ~
Buffers may be unloaded by the |:bunload| command or the buffer's
|'bufhidden'| option. When a buffer is unloaded its file contents are
freed from memory and vim cannot operate on the buffer lines until it is
reloaded (usually by opening the buffer again in a new window). API
methods such as |nvim_buf_get_lines()| and |nvim_buf_line_count()| will be
affected.
I'm concerned that if I remove the nvim_buf_is_loaded check I'll wind up introducing a regression; but I didn't have this kind of thing in the Ruby version (the scanner was just parsing :ls output), so this code is pretty new (added in 0b8c9ed, "feat(lua): continue sketching out UI", July 20, 2022).
I can certainly play around with removing it, and if I can't do that, I might be able to do some special-casing to detect when Neovim has just launched and skip the check in that case...
Originally posted by @jaapie in #394 (comment)
The text was updated successfully, but these errors were encountered: