perf: speed up session loading (#246)
* perf: only execute on current buffer since this event is called on each buffer * fix: only execute `SessionLoadPost` autocommand when a full session is loaded
This commit is contained in:
parent
2c80182d75
commit
b3c24f4b3b
1 changed files with 6 additions and 6 deletions
|
|
@ -1128,13 +1128,13 @@ M.setup = function(opts)
|
|||
group = aug,
|
||||
pattern = "*",
|
||||
callback = function(params)
|
||||
if vim.g.SessionLoad ~= 1 then
|
||||
return
|
||||
end
|
||||
local util = require("oil.util")
|
||||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
local scheme = util.parse_url(bufname)
|
||||
if config.adapters[scheme] and vim.api.nvim_buf_line_count(bufnr) == 1 then
|
||||
load_oil_buffer(bufnr)
|
||||
end
|
||||
local scheme = util.parse_url(params.file)
|
||||
if config.adapters[scheme] and vim.api.nvim_buf_line_count(params.buf) == 1 then
|
||||
load_oil_buffer(params.buf)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue