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,
|
group = aug,
|
||||||
pattern = "*",
|
pattern = "*",
|
||||||
callback = function(params)
|
callback = function(params)
|
||||||
|
if vim.g.SessionLoad ~= 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
local util = require("oil.util")
|
local util = require("oil.util")
|
||||||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
local scheme = util.parse_url(params.file)
|
||||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
if config.adapters[scheme] and vim.api.nvim_buf_line_count(params.buf) == 1 then
|
||||||
local scheme = util.parse_url(bufname)
|
load_oil_buffer(params.buf)
|
||||||
if config.adapters[scheme] and vim.api.nvim_buf_line_count(bufnr) == 1 then
|
|
||||||
load_oil_buffer(bufnr)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue