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

the first buffer autocommands not registered #12

Closed
m4cey opened this issue Jan 8, 2024 · 1 comment · Fixed by #13
Closed

the first buffer autocommands not registered #12

m4cey opened this issue Jan 8, 2024 · 1 comment · Fixed by #13

Comments

@m4cey
Copy link
Contributor

m4cey commented Jan 8, 2024

when starting a new neovim instance on a typst filetype, the buffer autocmds aren't created for that file.
but the next time I open a file in that same neovim instance, things work as expected. however the first buffer is still without autocmds.
I can manually refresh things with :set filetype=typst as a workaround.

I was able to reproduce this on a clean configuration with lazy.nvim and no other plugins.

@m4cey
Copy link
Contributor Author

m4cey commented Jan 10, 2024

update:
I noticed this only happens when the call to setup happens outside of lazy.nvim's plugin declaration like this:

require 'lazy'.setup({
	{
		'chomosuke/typst-preview.nvim',
		ft = 'typst',
		version = '0.1.*',
		build = function() require 'typst-preview'.update() end,
	},
})

require 'typst-preview'.setup {
 	debug = false,
 	get_root = function(_)
 		return vim.fn.getcwd()
 	end,
}

if I don't call setup outside or use opts to pass options or config = function(), everything works fine; which is probably all anyone needs

@m4cey m4cey closed this as completed Jan 10, 2024
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.

1 participant