Open tuanbass opened 1 year ago
Can't you do it with something like this?
vim.api.nvim_create_autocmd("BufAdd", {
callback = function(args)
if args.file:match ".*.test.ts" then
vim.cmd.Bdelete() -- famiu/bufdelete.nvim
vim.cmd.tabfirst()
vim.cmd.buffer(args.buf)
end
end,
})
Can't you do it with something like this?
vim.api.nvim_create_autocmd("BufAdd", { callback = function(args) if args.file:match ".*.test.ts" then vim.cmd.Bdelete() -- famiu/bufdelete.nvim vim.cmd.tabfirst() vim.cmd.buffer(args.buf) end end, })
Thanks for the answer. I tried with your suggestion. Unfortunately, using this config, I encountered few problem.
I will try to figure out what is wrong this weekend.
Anyway, IMHO it's easier and cleaner if we can include the policy inside the plugin config, rather have to create a separate auto-command.
I thought there would be an easy fix like a PreAdd event. I will think about it. Feel free to open a PR if you have something in mind, like the policy strategy.
After testing, I found some points:
bufferline bufs list
.
I'm looking for a way to define a condition to associate a set of file with a tab For example, I would like when openning, each "*.test.ts" come into a specific tab.
It's best if I can provide a callback to define association policy during setup, something like the pseudo code