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
## Details
Related issues:
- #309
- #315
- #317
Okay this is getting convoluted to handle the differences in lazy
loading between `lazy.nvim` and `vim-plug`. The issues are as follows:
- `lazy.nvim` & Lazy Loaded: Attempting to attach to current buffer at
the start will not pickup user configuration (called from plugin
directory before setup) so may not listen to all needed events. This
means we should not attach to current buffer and rely on the
`FileType` auto command.
- `vim-plug` & Lazy Loaded: The initial load swallows the `FileType`
event for the current buffer (`lazy.nvim` seems to trigger the event)
so first buffer will be ignored. This means we cannot rely on the
`FileType` auto command and need to attach to the current buffer.
To fix this we need to be aware of the plugin manager being used so we
can do the right thing, which sucks, but oh well.
The solution expands on our existing logic to hook into `lazy.nvim`
configuration for this plugin. When the user has NOT configured lazy
loading (via filetypes nor commands) we attempt to attach to the current
buffer. This means if they have we will skip attaching and will rely on
the `FileType` event.
This solves the `lazy.nvim` problem of not using the updated user
configuration. This does mean when not lazy loading with `lazy.nvim` we
will attempt to attach to the current buffer. This will initially fail
since the filetype will not be set for the buffer but will succeed for
the buffer later once the `FileType` event is triggered.
For `vim-plug` we don't have any hooks so no matter what it will look
like we are NOT lazy loading. This means we will attempt to attach to
the current buffer fixing the issue of lazy loading with `vim-plug`.
Have also added a check that buffer is valid in the `should_attach`
function. The issue related to this should be fixed from the other
updates but having it in place seems like a good idea in either case.
0 commit comments